and*_*nnn 0 iphone uitableview ios
是否可以返回NSMutableArray 的值(而不是计数)部分中的行数
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
NSLog(@"number of rows in section: %@",[arrayofNombre objectAtIndex:section]);//it prints the right value
return [arrayofNombre objectAtIndex:section];
}
Run Code Online (Sandbox Code Playgroud)
应用程序崩溃,当我输入一个常量值(例如返回2)时,应用程序运行但它没有给出预期的结果.我肯定错过了一些东西.谢谢你的帮忙.
看来你正在返回一个NSNumber,而该方法期待一个NSInteger.您应该如下转换NSNumber.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
NSLog(@"number of rows in section: %@",[arrayofNombre objectAtIndex:section]);//it prints the right value
return [[arrayofNombre objectAtIndex:section] intValue];
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
281 次 |
最近记录: |