質問

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