ビューの 1 つを構成しようとしています。寸法は適切に設定できますが、自動サイズ変更マスクを追加すると、すぐにサイズが変更されます。
- (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 です。スクロールビューとタブバーの間にマスクのある大きな白いセクションがあります。なぜこのようになっているのですか?どうすれば修正できますか?