我的问题略有不同,与我的标题所示不同。我已经使用过xib。现在我正在尝试使用故事板。
我的问题是,如果我们从一个类导航到另一个类,故事板是否能够提供更好的内存管理优势。
假设我们有两个视图控制器:ViewControllerA和ViewControllerB。
我们正在尝试通过ViewControllerA --> ViewControllerB进行导航。
现在,在Xib中,我们的方法如下:
ViewControllerB *VCB = [ [ViewControllerB alloc] init];
[self.navigationController pushViewController: VCB Animated: YES];
在故事板中的哪里?
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"Second"])
{
SecondViewController *objSecond = (SecondViewController*)[segue destinationViewController];
}
}
那么,请这样做,
[self performSegueWithIdentifier:@"Second" sender:self];
所以,我的问题是我们在Xib中分配了我们的类,在storyboard中没有。那么在storyboard中有没有内存分配的优势?