如何在Mail-App中使用下一个detailView

我想通过我的tableview的行跳进我的detailview。

将数据从tableview传递给detailview工作正常。 通过indexpath.row工作正常。

在详细信息视图中,我可以更改行的索引路径,并返回到tableview,右侧选中已更改的行。

我的问题是我无法在详细视图中查看新选定行的数据。

我希望你明白我想做什么:)

例如在邮件应用程序中:我想按下“下一步”按钮并获取相关数据。

下一个function:

- (IBAction)nextRow:(id) sender { NSLog(@"nextBtn"); TableRotateViewController *parent = (TableRotateViewController *)self.parentViewController; NSIndexPath *actualIndexPath = detailselectedRow; NSIndexPath * newIndexPath = [NSIndexPath indexPathForRow:actualIndexPath.row+1 inSection:actualIndexPath.section]; if([parent.view.subviews objectAtIndex:0]) { UIView * subview = (UIView *) [parent.view.subviews objectAtIndex:0]; UITableView *tView = (UITableView *) subview; [tView selectRowAtIndexPath:newIndexPath animated:YES scrollPosition:UITableViewScrollPositionMiddle]; [tView.delegate tableView:tView didSelectRowAtIndexPath:newIndexPath]; } } 

这是我的示例应用程序,以便更好地理解我所做的喷射: http : //www.file-upload.net/download-3896312/TableRotate.zip.html

如果您在详细页面中单击向左或向右按​​钮,是否要显示新的详细信息,对吧?

在父视图类(TableView布局)中,您应该创建包含一些特定对象的NSMutableArray(例如,“MailDetailObject”包含data1,data2,data3,…如您所愿)

并且您可以保持每个MailDetailObject包含每个详细信息,并将它们放在父视图类中的NSMutableArray中

现在,当您在tableView中选择了didselectRowAtIndexPath时,将此NSMutableArray和tableView上的当前索引发送到DetailView(不要忘记在DetailView中为从parentView发送的引用对象创建此属性)

在detailView, (IBAction)nextRow Method ,如果单击next,则可以引用从parentView发送的NSMutableArray中的下一个索引和查找,并获取要显示的下一个索引信息

希望它能帮助你