当我检查4英寸或3.5英寸屏幕时,我想在视图加载时移动几个按钮,但它没有做任何事情!为什么这行代码不起作用?即使有自己。顺便说一句,它不起作用。
- (void)viewDidLoad
{
CGRect screenbounds = [[UIScreen mainScreen]bounds];
if(screenbounds.size.height == 568){
checkbox1.frame = CGRectMake(0, 0, 30, 30);
}else{
if ([[UIScreen mainScreen] respondsToSelector:@selector(displayLinkWithTarget:selector:)] &&
([UIScreen mainScreen].scale == 2.0)) {
} else {
}
}
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
答案 0 :(得分:1)
由于您在xib中使用AutoLayout,可能没有任何动静。
我建议禁用它,但是从你的帖子看起来你应该实际利用自动布局。