gpt4 book ai didi

iOS - 将数据传递给推送的 View Controller

转载 作者:可可西里 更新时间:2023-11-01 03:37:21 24 4
gpt4 key购买 nike

当推送 View Controller 时,我如何同时传递长数据(例如“asdf”:123)?你应该向 NSBundle 添加对象吗?

最佳答案

MyViewController * myVC = [[MyViewController alloc] initWithNibName:nil bundle:nil];
myVC.someProperty = someValue; // Pass your data here
[self.navigationController pushViewController:myVC animated:YES];

在你的 MyViewController 类中:

.h

@interface MyViewController : UIViewController
@property (nonatomic, strong) NSString * someProperty;
@end

.m

@implementation MyViewController

- (void)viewDidLoad {
[super viewDidLoad];
// your data has been set
// self.someProperty is equal to "some value"
}

关于iOS - 将数据传递给推送的 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7979976/

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