xcode 4.5 how to pick storyboards at launch

前端 未结 5 1712
灰色年华
灰色年华 2020-11-29 16:49

Trying to make my app work with both iPhone 5 and iPhone 4/4s. I tried the \"AutoLayout\" but does not seem to work for my app also read that it is not supported in iOS 5.

5条回答
  •  执笔经年
    2020-11-29 17:34

    I took inspiration on fields.cage answer and adapted it to my code, it works fine. Thanks !!

    if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone){
            UIStoryboard *storyBoard;
    
            CGSize result = [[UIScreen mainScreen] bounds].size;
            CGFloat scale = [UIScreen mainScreen].scale;
            result = CGSizeMake(result.width * scale, result.height * scale);
    
            if(result.height == 1136){
    
    
                 self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController_iPhone5" bundle:nil] autorelease];
    
            }
            else
            {
                 self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil] autorelease];
            }
        }
    

提交回复
热议问题