gpt4 book ai didi

ios - 如何在 Mail-App 中查看下一个细节 View

转载 作者:行者123 更新时间:2023-11-29 13:43:51 25 4
gpt4 key购买 nike

我想通过我的表格 View 的行跳转到我的详细 View 。

将数据从 tableview 传递到 detailview 工作正常。传递 indexpath.row 也能正常工作。

在详细 View 中,我可以更改行的索引路径,并通过返回到 TableView 来正确选择更改的行。

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

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

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

下一个函数:

- (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];
}
}

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

最佳答案

在详情页点击左键或右键时,是否显示新的详情信息,对吗?

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

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

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

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

希望对你有帮助

关于ios - 如何在 Mail-App 中查看下一个细节 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8241463/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com