我正在尝试配置我的一种观点。我可以正确设置尺寸,但是当我添加自动调整蒙版时,它会立即改变尺寸。
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
UIScrollView* scrollView = [[UIScrollView alloc] initWithFrame: CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - self.tabBarController.tabBar.frame.size.height - self.navigationController.navigationBar.frame.size.height - 10)]; // -10 so I know it's not being hidden under the tabbar
scrollView.backgroundColor = [UIColor greenColor]; // easy recognition
scrollView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
[self.view addSubview: scrollView];
self.scroll = scrollView;
UITapGestureRecognizer* tap = [[UITapGestureRecognizer alloc] initWithTarget: self action:@selector(hmm)];
[self.navigationController.navigationBar addGestureRecognizer: tap];
}
- (void) hmm {
NSLog(@"Frame: %@", [NSValue valueWithCGRect: self.scroll.frame]);
}
我得到 357 没有面具和 264 面具。滚动视图和带有掩码的标签栏之间有一个很大的白色部分。为什么会这样?我该如何解决?