UIViewController 的frame 无法修改
我想修改下 UIViewController 的view的frame,在viewDidLoad的时候修改了是对的
但是为什么在ddd函数里面打印出来的跟没修改之前是一样的呢?(没有其他任何代码)
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
CGRect frame = self.view.frame;
frame.size.height -= 100;
self.view.frame = frame;
NSLog(@"Rollrock-%f-%f",self.view.frame.origin.y,self.view.frame.size.height);
NSLog(@"Rollrock~%f-%f",self.view.bounds.origin.y,self.view.bounds.size.height);
UIButton * btn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];
[btn addTarget:self action:@selector(ddd) forControlEvents:UIControlEventTouchDown];
[self.view addSubview:btn];
self.view.backgroundColor = [UIColor redColor];
}
-(void)ddd
{
NSLog(@"Rollrock-%f-%f",self.view.frame.origin.y,self.view.frame.size.height);
NSLog(@"Rollrock~%f-%f",self.view.bounds.origin.y,self.view.bounds.size.height);
}