我在调用此方法的两个不同设备上遇到此问题
- (void)drawRect:(CGRect)rect {
NSLog(@"%@", NSStringFromCGRect(rect));
NSLog(@"F: %@", NSStringFromCGRect(self.frame));
NSLog(@"B: %@", NSStringFromCGRect(self.bounds));
[super drawRect:rect];
}
在iOS8输出中是:
{{-1.5, -3}, {74, 22.5}}
F: {{235, 63.5}, {70, 15}}
B: {{0, 0}, {70, 15}}
但是iOS7的输出是:
{{0, 0}, {70, 15}}
F: {{235, 63.5}, {70, 15}}
B: {{0, 0}, {70, 15}}
答案 0 :(得分:0)
可能是因为状态栏。如果你想隐藏状态栏,那么这个或反之亦然
<key>UIStatusBarHidden</key>
<true/>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>