#import <UIKit/UIKit.h>
@interface tableview : UIViewController<UITableViewDataSource>
{
NSArray *listOfItems;
}
@property(nonatomic,retain) NSArray *listOfItems;
@end
#import "tableview.h"
@implementation tableview
@synthesize listOfItems;
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier ]autorelease];
}
//NSString *cellValue = [listOfItems objectAtIndex:indexPath.row];
cell.textLabel.text = [listOfItems objectAtIndex:indexPath.row];
return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 3;
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
listOfItems = [[NSArray alloc] initWithObjects:@"first",@"second",@"third", nil];
//listOfItems = [[NSMutableArray alloc]init];
// [listOfItems addObject:@"first"];
//[listOfItems addObject:@"second"];
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}
-(void)dealloc
{
[listOfItems release];
[super dealloc];
}
@end
2012-04-27 13:33:23.276テーブルビュー試験[438:207] - [のUIViewのtableView:numberOfRowsInSection:]:認識されていないセレクタはインスタンスに送信0x6855500
2012 -04-27 13:33:23.362テーブルビュー試験[438:207] *によりキャッチされない例外 'NSInvalidArgumentException'、理由にアプリを終了:
「 - 〔のUIViewのtableView:numberOfRowsInSection:]:インスタンス0x6855500に送られ、認識されないセレクター
'
*ファーストスローコールスタック:
(0x13bb052 0x154cd0a 0x13bcced 0x1321f00 0x1321ce2 0x1ecf2b 0x1ef722 0x9f7c7 0x9f2c1 0xa228c 0xa6783 0x51322 0x13bce72 0x1d6592d 0x1d6f827 0x1cf5fa7 0x1cf7ea6 0x1d8330c 0x23530 0x138f9ce 0x1326670 0x12f24f6 0x12f1db4 0x12f1ccb 0x12a4879 0x12a493e 0x12a9b 0x2282 0x21f5) がexceptionCurrent言語投げると呼ば終了:自動。現在objective-c(gdb)番組受信信号SIGABRT(Xcodeの)
テーブルビューのデータソースとデリゲートプロパティが正しく設定されていません。使用しているものとクラッシュする理由の詳細を追加する必要があります。 – rishi
問題はここにあります:[UIView tableView:numberOfRowsInSection:]認識できないセレクタがインスタンス0x6855500に送信されました。このテーブルビューを使用するコードを投稿してください。 – Lolloz89
mボタンを含むビューから転送しようとしています。そのボタンを押しています。毎回、テーブルビューを含む新しいビューに転送したいです。私はこのエラーが発生するデバッグ...私はiOSシミュレータをリセットしようとしましたが、動作しません – manish1990