我的应用中有两个UIViewController
。在执行segue
之前,其中一个将数据传递给另一个。然而,这个segue真的很慢,需要几秒钟。这是代码:
- (IBAction)barButtonRight:(id)sender {
[[self.restaurant current] setName:self.textField.text];
[self performSegueWithIdentifier:@"showRestaurant" sender:self];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"showRestaurant"]) {
UINavigationController *navController = segue.destinationViewController;
RestaurantViewController *viewController = [navController.viewControllers objectAtIndex:0];
viewController.restaurant = self.restaurant;
}
}
当我评论viewController.restaurant = self.restaurant
时,segue处于正常速度。有什么想过我怎么解决这个问题?
===
编辑:
事实证明,UITextView
方法中的viewDidLoad
使其变慢。这是代码:
self.myTextView = [[UITextView alloc] init];
self.myTextView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
self.myTextView.backgroundColor = [UIColor whiteColor];
self.myTextView.textColor = [UIColor textColor];
self.myTextView.font = [UIFont fontWithName:@"Raleway-Light" size:self.myTextView.font.pointSize];