简体   繁体   中英

Ipad/iphone..universal app

Hello I am creating universal app for iphone and i pad. I have table views and next views ..It is working fine in ipad but i want to add split view for ipad only.. how to do this in same code?

Create split view in MainWindow-iPad.xib and connect win your appdeletegate.

You need to check in appdelegate.h and .m file.

in .h file

UISplitViewController *splitViewController;
SearchViewController *ipad_listViewController;
DetailResultViewController *ipad_detailViewController;

@property (nonatomic, retain) IBOutlet UISplitViewController *splitViewController;
@property (nonatomic, retain) SearchViewController *ipad_listViewController;
@property (nonatomic, retain) DetailResultViewController *ipad_detailViewController;

in .m file

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    // Override point for customization after app launch    
    [self createDatabaseIfNeeded];

    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
    {
        // Add the split view controller's view to the window and display.
        [window addSubview:splitViewController.view];
        [window makeKeyAndVisible];
    }
    else {
        [window addSubview:[navigationController view]];
        [window makeKeyAndVisible];

    }

    return YES;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM