Checking for different devices

Discussion in 'iOS Programming' started by V-Appel, Jun 23, 2014.

  1. V-Appel macrumors newbie

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

     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...

     else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone){
     NSLog(@"its an iPhone");
            yCord = 70; 
            xCord = 20;
    This if statment is located in my
  2. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    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?
  3. JohnsonK macrumors regular

    Mar 6, 2014
    You have to be aware that the best place to set frame is inside the viewDidLayoutSubviews method

Share This Page