Universal iPhone and iPad Application

I am creating a simple app and have begun this and its running a universal app so I have my normal files and folders and an folder called iPad, with a single xib file.

When I run this the splash screen work fine for both, but both iPad and iPhone go to the iPhone view controller, how can I get the iPad go to its own view controller.

This is because I want to present the app pages with in the iPad slightly different etc.

AM I right in sayign I need to create a .h and .m files for the iPad xib file and then assign this to these then it run's??

EDIT ADDITIONAL

I would like to create a split view application version for the iPad but rather than create two separate projects how can I change / create my iPad view into a spilt view? Are there any links to this for ease or is this quite simple?

In answer to this then I think not.

Many Thanks Si


我还没有使用通用应用程序(或分割视图),但我知道你所问的大部分内容在斯坦福大学iOS开发应用课程的第7部分。


您可以使用下面的代码检查设备的天气,它会是iPad或iPhone。

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {  

#if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 30200)
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) //ipad
{
    ipadiphoneflag=@"1"; // ipad
}
else
{
    ipadiphoneflag=@"0"; // iphone

}
#else // iphone
    ipadiphoneflag=@"0";
#endif  

//After you can call respective controller base on device

if([ipadiphoneflag intValue]==0)//Load view of iphone controller
{

    [self.navigationController setNavigationBarHidden:YES];
    [window addSubview:navigationController.view];
    [window makeKeyAndVisible];
}
else //Load view of iPad controller
{
    if(ipad_navigationcontroller==nil)
        ipad_navigationcontroller=[[UINavigationController alloc]initWithRootViewController:objipad];
    [self.ipad_navigationcontroller setNavigationBarHidden:YES];
    [window addSubview:ipad_navigationcontroller.view];
    [window makeKeyAndVisible];
}


}

Hopefully i have answered my own question.

I created a .h and .m file then reassigned the iPad xib files class to the .h file and it seemed to work and load this view instead of the generic one.

As for the universal app with iPads split view I am still working on.

链接地址: http://www.djcxy.com/p/95788.html

上一篇: SplitView就像iPhone上的Facebook应用程序一样

下一篇: 通用iPhone和iPad应用程序