Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

V-Appel

macrumors newbie
Original poster
Oct 1, 2013
5
0
I´m trying to check if the device is an iPhone or an iPad and it´s working. I´m just checking with:

Code:
 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){         NSLog(@"its an iPad");
 }
But I want to use this for setting some different int values so different things location is costume to what ever device they are using. But my values in this example aren´t beeing set... So all locations equals 0 when I run it and everything ends up in one spot...

Code:
 else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone){
       
 NSLog(@"its an iPhone");
        yCord = 70; 
        xCord = 20;
}
This if statment is located in my
Code:
-(id)initWithSize:(CGSize)size
method.
 
Can you provide us with the more of the code for initWithSize:, especially the if part before the else-if? Also, how and where are you declaring xCord and yCord? And where / how are you using their values?
 
You have to be aware that the best place to set frame is inside the viewDidLayoutSubviews method
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.