![](/img/trans.png)
[英]didSelectrow doesn't work with scrollview and tableview (iOS)
[英]DetailView in TableView doesn't work (IOS)
我從一個帶有Tabbar控制器和4個按鈕的程序開始。 在其中一個頁面上,viewController中有一個表格視圖。 當我單擊該行時,我想推送一個DetailView。 但是什么也沒發生,沒有錯誤什么都沒有???
有人知道什么是錯的嗎?
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//Get the selected item
NSString *selectedItem = [listOfItems objectAtIndex:indexPath.row];
//Initialize the detail view controller and display it.
DetailViewController *myController = [[DetailViewController alloc]
initWithNibName:@"DetailViewController"
bundle:[NSBundle mainBundle]];
myController.title = @"Detail View";
myController.selectedItem = selectedItem;
[self.navigationController pushViewController:myController animated:YES];
[myController release];
}
僅當您的應用程序支持UINavigation Controller時,才可以導航到另一個View Controller 。 如果它在那里,那么您的UITableViewDelegates不在那里。
為此,您需要
tableView.delegate =自我;
或請進一步闡述您的問題
您確定設置了UITabelViewDelegate
嗎? 如果沒有,請設置UITableView
的委托為
tableView.delegate = self;
還要確保您的頭文件實現了UITableViewDelegate
協議
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.