quarta-feira, 23 de novembro de 2011

App universal a partir de uma "Empty Application"

Pessoal,

Este vídeo mostra o início de um projeto para app universal (iPhone, iPad e iPod Touch).
Como saber quando mostrar a tela desenhada para iPhone ou iPad.
Xcode 4.2 - Projeto baseado em "Empty Application".




Download: AppUniversal.zip

// AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.
    
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        _viewController = [[[UIViewController alloc] initWithNibName:@"TelaViewController_iPhone" bundle:nil] autorelease];
    }else{
        _viewController = [[[UIViewController alloc] initWithNibName:@"TelaViewController_iPad" bundle:nil] autorelease];
    }
    
    self.window.rootViewController = self.viewController;
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    return YES;
}