如何下一个detailView像在Mail-App中一样 [英] how to next detailView like in Mail-App

查看:76
本文介绍了如何下一个detailView像在Mail-App中一样的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的detailview中跳过表格视图的行.

i want to jump in my detailview through the rows of my tableview.

将数据从tableview传递到detailview可以正常工作. 通过indexpath.row也可以正常工作.

passing the data from the tableview to detailview works fine. passing the indexpath.row working fine, too.

在detailview中,我可以更改行的索引路径,并通过返回到tableview,可以选择更改后的行.

in the detailview i can change the indexpath of the row and by returning to the tableview the changed row is selected right.

我的问题是我无法在detailview中查看新选择的行的数据.

And my problem is that i cant view the data of new selected row in the detailview.

我希望你理解我正在尝试做的事情:)

i hope you understand what i am trying to do :)

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

for example like in the mail app: i want to push the "next" button and get the associated data .

下一个功能:

- (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

Here is my sample application for better understanding what i have done jet: http://www.file-upload.net/download-3896312/TableRotate.zip.html

推荐答案

在详细页面上单击向左或向右按​​钮时,您想显示新的详细信息吗?

Would you like to show new detail information when click left or right button in detail Page , right?

在父视图类(TableView布局)中,应创建NSMutableArray,其中包含一些特定对象(例如,"MailDetailObject",其中包含data1,data2,data 3,...,如您所愿)

In the Parent View Class (TableView Layout), you should create NSMutableArray that contain some specific object (ex. "MailDetailObject" that containg data1 , data2 ,data 3 ,... as you wish)

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

and you could keep each MailDetailObject contain each detail information and put them together to NSMutableArray in Parent View Class

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

and now , when you didselectRowAtIndexPath in tableView , send this NSMutableArray and your current index on tableView to DetailView (Don't forget to create this property in DetailView for refer object that send from parentView)

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

In the detailView , (IBAction)nextRow Method , if you click next you can refer to the next index and lookup in NSMutableArray that have sent from your parentView and get the next index information to display

希望对您有帮助

这篇关于如何下一个detailView像在Mail-App中一样的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆