有一個root的ViewController 類,調用OnlineViewController的視圖:
- (void)eventTap:(UIGestureRecognizer *)gestureRecognizer {
self.evc = [[EventViewController alloc]init];
[self presentViewController:self.evc animated:YES completion:nil];
}
嘗試從OnlineViewController中調用ViewController的視圖時失敗了。
-(void ) iconAction{
self.vc = [[ViewController alloc]init];
[self presentViewController:self.vc animated:YES completion:nil];
如何調用ViewController的視圖?
主viewController 通過presentViewController:animated:completion: 方法彈出新視圖EventViewController 你如果想在彈出的視圖中返回到主視圖,關閉這個彈出視圖即可
在EventViewController 的-(void)iconAction: 中調用
[self dismissViewControllerAnimated:YES completion:nil];