ios - 当我使用 Storyboard id 时如何将数据传递到目标 View ?

标签 ios objective-c uistoryboard uistoryboardsegue

基本上,当我想将数据从源 View 传递到目标 View 时,我使用“prepareForSegue”方法并使destinationView 等于segue 的destinationView。

但是,如果我想在下面的代码中使用 Storyboard ID 来呈现我当前 View 的上方:

MyCustomViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"MyViewController"];
[self presentViewController:vc animated:YES completion:nil];

如何使用 Storyboard ID 将数据从当前 View 传递到目标 View ?

最佳答案

同样的方法..

MyCustomViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"MyViewController"];
vc.someProperty = something;  //use your data here
[self presentViewController:vc animated:YES completion:nil];

关于ios - 当我使用 Storyboard id 时如何将数据传递到目标 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34606978/

相关文章:

objective-c - 为什么 Xcode/LLVM 在为 ARM64 编译时优化此方法返回的变量

ios - UITableView:如何只实现一行与其他行不同

没有开发者账号的iOS开发(没有AppStore)

ios - 修复了 UICollectionView 中的静态单元格

iPhone:如何获取本地货币符号(即 "$"而不是 "AU$")

ios - 如何以编程方式显示具有 Storyboard 中定义的导航 Controller 和标签栏 Controller 的 Controller ?

ios - 从 View Controller 的分离文件中呈现 View Controller

ios - 为按钮提供等宽约束时,自动布局设置不正确

ios - Phonegap/Sencha 语言本地化

ios - TableView 上的 Swift reloadData