iUs*_*ser 1 iphone xcode uitableview
我正在制作一个应用程序,我正在使用基于视图的应用程序.
我的第一个视图是一个简单的视图控制器类.该视图中有一些按钮.
当我点按按钮时,我想要tableview.
所以我正在使用UITableViewController子类.
我的硬币是什么
- (void)viewDidLoad
{
[super viewDidLoad];
NSBundle *bundle =[NSBundle mainBundle];
NSString *path = [bundle pathForResource:@"cases" ofType:@"plist"];
listfile = [[NSArray alloc ] initWithContentsOfFile:path];
[self loadView];
}
- (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];
}
// Configure the cell...
NSArray *temp = [listfile objectAtIndex:indexPath.row];
cell.textLabel.text = [temp objectAtIndex:0];
NSLog(@"Count : %@" , cell.textLabel.text);
return cell;
}
Run Code Online (Sandbox Code Playgroud)
但是,我看不到任何数据.它只显示空白表.我做错了什么?
谢谢.
您应该在以下方法中实现以下方法UITableViewController:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in section.
return [caselist count];
}
Run Code Online (Sandbox Code Playgroud)
和
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2913 次 |
| 最近记录: |