Frage

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.
  }
War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top