在我的应用程序的 iPad 版本中,我有一个 a 的UIView
子视图TPKeyboardAvoidingScrollView
,由xib
它作为其框架创建(0.0, 1024, 437)
。当您在输出框架中运行应用程序时,(0.0, 1024, 800)
相应的高度几乎是它应该具有的两倍。这是什么意思?我该如何解决?
编码:
//self.scrollView is a TPKeyboardAvoidingScrollView
CGFloat width = self.scrollView.frame.size.width;//is correct
CGFloat progY = 0;
self.view1.frame = CGRectMake(0, progY, width,
self.view1.frame.size.height);
[self.scrollView addSubview:self.view1];
progY+= self.view1.frame.size.height;
//is correct, the height is equal to that of the xib
self.view2.frame = CGRectMake(0, progY, width, self.view2.frame.size.height);
NSLog(@"the frame of view2 is %@", NSStringFromCGRect(self.view2.frame));
//the frame of view2 is {{0, 215}, {1024, 800}}
//the height would be 437 as in xib
[self.scrollView addSubview:self.view2];
progY+= self.view2.frame.size.height;//is wrong
//....