我正在使用UITabBarController和自定义标签。
我在viewDidLoad方法中有以下代码。
[[NSBundle mainBundle] loadNibNamed:@"CustomTabUIView" owner:self options:nil];
_enclosingView.frame=CGRectMake(0, self.view.frame.size.height-49, self.approveStatutoryButton.frame.size.width * 2, 30);
_scrollView.contentSize=CGSizeMake(_approveStatutoryButton.frame.size.width*2, 0);
[self.view addSubview:_enclosingView];
有两个宽度为244和高度为49的按钮。所以我要使滚动视图和封闭视图适合这个尺寸。
但问题是,
答案 0 :(得分:1)
[[NSBundle mainBundle] loadNibNamed:@"CustomTabUIView" owner:self options:nil];
CGSize * windowSize=[[[UIApplication sharedApplication] delegate] window].frame.size,
_enclosingView.frame=CGRectMake(0, windowSize.height-49, windowSize, 30);
_scrollView.contentSize=CGSizeMake(windowSize*2, 30);
[self.view addSubview:_enclosingView];
注意:窗口大小包含整个屏幕的宽度适当地使用它