1
A
回答
6
重写这个UItableViewDelegate的委托方法。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
//Value Selected by user
NSString *selectedValue = [displayValues objectAtIndex:indexPath.row];
//Initialize new viewController
NewViewController *viewController = [[NewViewController alloc] initWithNibName:@"NewViewController" bundle:nil];
//Pass selected value to a property declared in NewViewController
viewController.valueToPrint = selectedValue;
//Push new view to navigationController stack
[self.navigationController pushViewController:viewController animated:YES];
}
看到这个链接,了解更多信息
1)Table view tutorial
2)StackOverflow similar question
2
您可以使用UINavigationController
并在didSelectRowAtIndePath:
方法中调用pushViewController:
。
要显示信息,我会创建一个新的UIViewController
,并创建一些可以设置用于显示信息的属性。
0
您必须实现方法的一码“(无效)的tableView:(UITableView的*)的tableView didSelectRowAtIndexPath方法:(NSIndexPath *)indexPath'。当您选择表格中的单元格时,将调用此方法。这就是为什么你必须实现你想要的。
我希望以下代码对您有所帮助。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (!yourObject) {
yourObject = [[yourViewController alloc] initWithNibName:@"yourViewController" bundle:nil];
}
UIBarButtonItem *backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:nil action:nil];
self.navigationItem.backBarButtonItem = backBarButtonItem;
[backBarButtonItem release];
[self.navigationController pushViewController:yourObject animated:YES];
}
0
尝试这种在didSelectRowAtIndexPath
方法,你可以创建该类的对象,你可以 用户:NavigationController
或者presentModleViewController
去另一个视图。
[self.navigationController pushViewController:yourClassobject animated:YES];
或
[self presentModalViewController:yourClassobject animated:YES];
相关问题
- 1. 我怎样才能当视图推
- 2. 点击表格行推新视图
- 3. didSelectRowAtIndexPath不推送新视图
- 4. 单击注释视图时无法推送新视图
- 5. PlayFramework。 JSONP视图。怎么样?
- 6. Git:如果我在推送前忘记更新会怎么样
- 7. 我怎样才能存储点击QPushbuttons
- 8. 是怎样炼成的LinearLayout可点击
- 9. Custom Table View Cell
- 10. Javascript select table cell
- 11. WordML:Set Table Cell Width
- 12. 我怎样才能打开的可扩展列表视图的新活动点击
- 13. 我怎样才能加载视图
- 14. 离子推送通知点击功能
- 15. 不能让我的视图可点击
- 16. Angular routeProvider,如果我已经在那个视图上,我怎么能不更新视图?
- 17. 我怎样才能让列表项目在Android上可点击
- 18. 我怎样才能使dynatree标题中的span-element可点击
- 19. 视图和控制器彼此不可见?怎么会这样?
- 20. 什么是CLASS:wxWindowNR在AutoIt中,我怎样才能点击控件?
- 21. 从推送通知中推送视图
- 22. 我可以点击tableview cell show picker吗?
- 23. Tableview cell change cell backgroung image(png)on点击
- 24. JavaFX Table/TreeTable Cell Overflow
- 25. Sql Table dynamic cell typ
- 26. JavaFX Table view Cell Reuse
- 27. 制作图库,怎么样?
- 28. 列表视图 - 点击新的视图
- 29. 推送到详细视图
- 30. 我怎样才能在网格视图