- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated{
// ---------------------- 功能分区 -----------------------------
// 把系统准备的导航控制器赋值给自己声明的属性
// 如果不把他提前声明一个navigationController的属性在这里接住它,那么在剩下面的doneAction/的按钮点击事件里取不到一个导航控制器push到新的页面,
self.ng=navigationController;
//设置系统页面显示图片的控件的尺寸 不然的话会被自己添加的控件盖上
UIView *puView = [viewController.view.subviews firstObject];
CGRect frame = puView.frame;
frame.size.height = 567;
puView.frame = frame;
// ---------------------- 功能分区 ----------------------------
self.vv=[[UIView alloc]initWithFrame:CGRectMake(0, 560, 375, 100)];
self.vv.backgroundColor=[UIColor redColor];
[viewController.view addSubview:self.vv];
self.sv = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 20, 375, 80)];
self.sv.backgroundColor = [UIColor blueColor];
[self.vv addSubview:self.sv];
UIButton *doneBtn = [[UIButton alloc]initWithFrame:CGRectMake(325, 0, 50, 20)];
[doneBtn setTitle:@"Done" forState:UIControlStateNormal];
[self.vv addSubview:doneBtn];
[doneBtn addTarget:self action:@selector(doneAction) forControlEvents:UIControlEventTouchUpInside];
}
转载于:https://www.cnblogs.com/lanyisanqqi/p/5156372.html
