Pergunta

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.
  }
Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top