我有我的presentViewController代码设置如下:
ProductViewController *vc = [[ProductViewController alloc] init]; [self presentViewController:vc animated:YES completion:nil];它确实呈现了vc控制器,但我无法点击它,它就像一个冻结的屏幕。 是因为还有一个观点吗? 或者我不应该使用alloc] init ?
ProductViewController是一个现有的视图控制器(它实际上是根视图控制器),所以基本上我只想让presentViewController返回到根视图控制器。
编辑:
我有一个ShippingViewController ,用户输入名称/运输详细信息。
然后他们点击“Checkout”按钮,显示PaymentViewController (其中有一个导航栏,所有其他View Controller都没有)。 在PaymentViewController ,用户输入他们的信用卡详细信息并点击“付款”按钮。
如果付款成功,我希望展示ProductViewController (初始/根视图控制器)。 目前,如果我只是调用dismissViewController ,它会显示ShippingViewController 。
I have my presentViewController code set up like this:
ProductViewController *vc = [[ProductViewController alloc] init]; [self presentViewController:vc animated:YES completion:nil];It indeed presents the vc controller, but I'm unable to tap anything on it, it's like a frozen screen. Is it because there is still a view on top of it? Or I shouldn't be using alloc] init?
ProductViewController is an existing view controller (it's actually the root view controller), so basically I'd just like the presentViewController to just go back to the root view controller.
Edit:
I have a ShippingViewController where the user enters name/shipping details.
Then they tap on "Checkout" button that presents the PaymentViewController (which has a navigation bar, all other View Controllers don't). On the PaymentViewController, the user enters their credit card details and tap the "Pay" button.
If the payment is successful, I wish for ProductViewController (the initial/root view controller) to be presented. Currently if I am just calling dismissViewController, it presents ShippingViewController.
最满意答案
这似乎解决了我的问题:
NSString *storyboardName = @"Main"; UIStoryboard *storyboard = [UIStoryboard storyboardWithName:storyboardName bundle: nil]; UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"id"]; [self presentViewController:vc animated:YES completion:nil];This seemed to take care of my problem:
NSString *storyboardName = @"Main"; UIStoryboard *storyboard = [UIStoryboard storyboardWithName:storyboardName bundle: nil]; UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"id"]; [self presentViewController:vc animated:YES completion:nil];更多推荐
发布评论