在开发中,经常在一个UIViewController(AViewController)弹出一个UIView,再从UIView跳转到另一个控制器(BViewController),但是在UIView中是没有以下的的一些方法的。
[self.navigationController pushViewController: animated: ];
[self.navigationController popViewControllerAnimated:];
[self presentViewController: animated: completion: ];
[self dismissViewControllerAnimated: completion:];
所以可以这样做,在UIView的H文件中,添加
@property (nonatomic,strong) UIViewController * viewcontroller;
之后在M文件的button的点击方法里:
-(void)BtnClick{
BViewController * bviewcontroller = [[AViewController alloc] init];
[self. viewcontroller.navigationController pushViewController: bviewcontroller animated:YES];
}
之后在AViewcontroller 弹出UIVew处,写上
view.viewcontroller=self;
网友评论