Question

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.
  }
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top