我的代码看起来不错吗?我试图加载数据到我的表格视图和详细的子视图。我的表工作正常,但数据在我的子画面不会加载带有详细子视图的警告消息?
出现这个
nextController.dataItem = [data objectAtIndex:indexPath];
这里下的警告是我RootViewController.m
// Configure the data for the cell.
NSDictionary *dataItem = [data objectAtIndex:indexPath.row];
cell.icon = [UIImage imageNamed:[dataItem objectForKey:@"Icon"]];
cell.publisher = [dataItem objectForKey:@"Publisher"];
cell.name = [dataItem objectForKey:@"Name"];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NextViewController *nextController = [[NextViewController alloc] initWithNibName:@"NextView" bundle:nil];
nextController.dataItem = [data objectAtIndex:indexPath];
[self.navigationController pushViewController:nextController animated:YES];
[nextController release];
}
和我nextviewcontroller.h
#import <UIKit/UIKit.h>
@interface NextViewController : UIViewController
{
UILabel *nameLabel;
UIImageView *iconView;
NSDictionary *dataItem;
}
@property (nonatomic, retain) IBOutlet UILabel *nameLabel;
@property (nonatomic, retain) IBOutlet UIImageView *iconView;
@property (nonatomic, retain) NSDictionary *dataItem;
@end
它加载但我得到以下警告:
“警告:传递的参数1 'objectAtIndex:' 将指针整数,未作铸
调试器说
终止应用程序由于未捕获的异常 'NSRangeException',究其原因: '*** - [NSCFArray objectAtIndex:]:index(64244544)beyond bounds(50)'
任何想法?
在你的 - (空)的tableView:(UITableView的*)的tableView didSelectRowAtIndexPath方法:(NSIndexPath *)indexPath你犯了一个错误。 使用nextController.dataItem = [data objectAtIndex:indexPath.row]; – 2010-02-21 23:22:13