這可能是一些簡單的錯誤,我似乎無法在我的代碼中找到它。didSelectRowAtIndexPath引發異常
當過我在tableview中單擊單元格,我得到一個異常
這是我的接口:
@interface MenuViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>
@end
我不使用XIB文件,所以這是我的loadView
- (void)loadView
{
UIView *myview = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.title = @"Menu";
UITableView *tableViewMenuItems = [[UITableView alloc] initWithFrame:CGRectMake(10, 10, 300, 150) style:UITableViewStyleGrouped];
tableViewMenuItems.backgroundColor = [UIColor clearColor];
tableViewMenuItems.delegate = self;
tableViewMenuItems.dataSource = self;
tableViewMenuItems.scrollEnabled = NO;
[myview addSubview:tableViewMenuItems];
[tableViewMenuItems release];
self.view = myview;
[myview release];
}
這是選擇行的代表方法
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
SendMessageViewController *sendMessageViewController = [[SendMessageViewController alloc] init];
[self.navigationController pushViewController:sendMessageViewController animated:YES];
[sendMessageViewController release];
}
我的BT
#0 0x94e3c9c6 in __pthread_kill()
#1 0x98079f78 in pthread_kill()
#2 0x9806abdd in abort()
#3 0x9588a921 in abort_message()
#4 0x958881bc in default_terminate()
#5 0x010ee23b in _objc_terminate()
#6 0x958881fe in safe_handler_caller()
#7 0x95888268 in std::terminate()
#8 0x958892a0 in __cxa_throw()
#9 0x010ee416 in objc_exception_throw()
#10 0x00f9c0bb in -[NSObject(NSObject) doesNotRecognizeSelector:]()
#11 0x00f0b966 in ___forwarding___()
#12 0x00f0b522 in __forwarding_prep_0___()
#13 0x0008c870 in -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:]()
#14 0x00082b05 in -[UITableView _userSelectRowAtPendingSelectionIndexPath:]()
#15 0x0079c79e in __NSFireDelayedPerform()
#16 0x00f7b8c3 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__()
#17 0x00f7ce74 in __CFRunLoopDoTimer()
#18 0x00ed92c9 in __CFRunLoopRun()
#19 0x00ed8840 in CFRunLoopRunSpecific()
#20 0x00ed8761 in CFRunLoopRunInMode()
#21 0x011d21c4 in GSEventRunModal()
#22 0x011d2289 in GSEventRun()
#23 0x00023c93 in UIApplicationMain()
#24 0x00002589 in main (argc=1, argv=0xbffff698) at main.m:14
我在做什麼錯?
什麼是顯示在源代碼中的Xcode?在什麼行app've停止了什麼錯誤? – Nekto
調試器在'didSelectRowAtIndexPath'中輸入嗎? – Nekto