我有一个对象从我的主 VC 发送到 viewDidLoad 中的 MasterTabViewController(UITabBarController) 我 NSLog 对象,它显示了对象,很好。现在我需要该对象转到第一个选项卡 UIViewController。我尝试了多次,无法让它去。我是新人,请原谅我的无知,
我通过 segue 将对象从我的主 vc 发送到我的 MasterTabViewController:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"showLogin"])
{
MasterTabViewController *preview = segue.destinationViewController;
preview.communityTapped = self.tempCommunity;
}
}
^这很好用!^ self.tempCommunity 是一个实例社区对象。
MasterTabViewController.h
- (void)viewDidLoad
{
[super viewDidLoad];
FirstTabViewController *firstvc;
firstvc.communityTapped = self.communityTapped;
NSLog(@"%@ !!!!!!!!! ",self.communityTapped.commDescription);
// Do any additional setup after loading the view.
}
FirstTabViewController.h
@property (nonatomic, strong) IBOutlet UILabel *descriptionLabel;
@property (nonatomic, strong) Community *communityTapped;
FirstTabViewController.m
- (void)viewDidLoad
{
self.descriptionLabel.text = self.communityTapped.commDescription;
[super viewDidLoad];
// Do any additional setup after loading the view.
}
如果有人可以提供帮助,我将不胜感激,因为我已经多次尝试并失败了。