문제

I want to move a few buttons when the view loads when I check for 4inch or 3.5 inch screen but it doesn't do anything! Why doesn't this line of code work? Even with self. it doesn't work by the way.

  - (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.
  }
도움이 되었습니까?

해결책

Likely nothing is moving because you are using AutoLayout in your xib.

I'd suggest disabling it, but from your post it looks like instead you should actually harness autolayout.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top