所以我得到了一个带有if
语句并按下StartViewController
的按钮。我在此viewcontroller的NSLog@"transition successful"
中创建了一个viewDidLoad
,以检查是否进行了转换。
在日志中,其显示转换成功,但在屏幕上未进行转换。
这是代码:
-(IBAction)initialButton:(id)sender {
NSLog(@"initialButton clicked");
if([userEmail.text length] <4)
{
[WCAlertView showAlertWithTitle:@"Email is empty" message:@"You haven't entered an email yet. Please enter one so we can sent you the shipping labels." customizationBlock:^(WCAlertView *alertView) {
alertView.style = WCAlertViewStyleBlackHatched;
} completionBlock:^(NSUInteger buttonIndex, WCAlertView *alertView) {
if (buttonIndex == 0) {
NSLog(@"Cancel");
} else {
NSLog(@"Ok");
}
} cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok", nil];
}
else
{
StartViewController *startViewController = [[StartViewController alloc] init];
self.transitionController = [[[TransitionController alloc] initWithViewController:startViewController] initWithNibName:@"StartViewController" bundle:nil];
[initialViewController.view removeFromSuperview];
self.window.rootViewController = self.startViewController;
}
}
这是日志:
2012-12-14 09:22:55.431 Janssenpakketapp[24165:c07] initialViewController loaded
2012-12-14 09:23:04.021 Janssenpakketapp[24165:c07] initialButton clicked
2012-12-14 09:23:06.116 Janssenpakketapp[24165:c07] Ok
2012-12-14 09:23:11.909 Janssenpakketapp[24165:c07] initialButton clicked
2012-12-14 09:23:11.911 Janssenpakketapp[24165:c07] transition succesful
最佳答案
新的更新:这应该工作:
StartViewController *startViewController = [[StartViewController alloc] init];
[[UIApplication sharedApplication].delegate.transitionController transitionToViewController:startViewController withOptions:UIViewAnimationOptionTransitionFlipFromRight];
关于iphone - ViewController之间的过渡不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13875075/