NewViewController always with two pens (iPhone and iPad)
You will see a templates folder inside "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode" here you will see project files and templates that you can edit or create a new one if you like.
Depending on your question go to this folder "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/File Templates"
Here you can achieve what you are trying to do by adding an empty navel for the iPad using the nib view controller template. I downloaded the sample I made, it still works but it will create 2 nibs as needed.
[my custom template]
http://www.saplogix.net/Xcode_Custom_Template/TwoNibTemplate.zip
extract and copy that inside this folder "~/Library/Developer/Xcode/Templates/File Templates"
Note: create the directory if it not already there.
Todo: add code to download a specific nib based on the device, which you just need to add as well. Also it will only work for UIViewController as superclass.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
}
else
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
{
NSString *_nibBundleOrNil = (NSString *)(nibBundleOrNil != nil ? [nibNameOrNil stringByAppendingString:@"_iPad"] : [NSStringFromClass([self class]) stringByAppendingString:@"_iPad"]);
self = [super initWithNibName:_nibBundleOrNil bundle:nibBundleOrNil];
}
if (self)
{
// Custom initialization
}
return self;
}
My template will create the following entry and you can use it to create a dual tip controller.
source to share
Create a viewcontroller with the following naming convention: either create an iphone / ipad xib like "viewcontrollername~iPhone.xib"
or@"viewcontrollername~iPad.xib"
and below link states is the same, provides a way to differentiate ipad and iphone in your viewcontroller.h and viewcontroller.m
http://iphonedevelopment.blogspot.de/2010/04/converting-iphone-apps-to-universal.html
source to share
When you create your new Xcode project, select the Single View app from the options page, from the Devices drop-down list, select Universal. This will create both iPhone and iPad.
From the beginning to the end:
File -> New Project
Select Application Single View → Next
Devices → Universal
source to share