我已按照教程Passing Data between View Controllers部分傳遞數據轉發。我的代碼是:將整數傳遞給DetailViewController
MasterViewController.h:
-(void)pushViewController: (UIViewController *)detailVC animated:(BOOL)animated;
MasterViewController.m:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell=[tableView cellForRowAtIndexPath:indexPath];
NSInteger num = indexPath.row;
DetailViewController *detailVC = [[DetailViewController alloc] initWithNumber:indexPath.row];
detailVC.number = num;
[self pushViewController:detailVC animated:YES];
}
我想整數NUM傳遞給我的DetailViewController。但是我得到了線程1:SIGABRT。發生什麼事?
見http://raywenderlich.com/ 10209/my-app-crashed-now-what-part-1 – rmaddy
添加斷點並檢查... –
向您的帖子中添加'pushViewController:animated:'方法代碼。 –