Monday, 15 August 2011

ios - newViewController always with two nibs (iPhone & iPad) -



ios - newViewController always with two nibs (iPhone & iPad) -

i want set xcode universal apps, when create new viewcontroller videovc, must create 2 nib files like,

videovc_iphone

videovc_ipad

can 1 help me out. no guidelines. steps. thanks

you see templates folder within "/applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/library/xcode" here see file , project templates can edit or create new 1 if want to.

specific question, navigate folder "/applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/library/xcode/templates/file templates"

here can accomplish trying adding blank nib ipad in template view controller nib. have upload sample did, it's still work in progress create 2 nibs need.

[my custom template] http://www.saplogix.net/xcode_custom_template/twonibtemplate.zip extract , re-create within folder "~/library/developer/xcode/templates/file templates" note: create directory if it's not there.

todo: add together code load specific nib based on device done need add together that. work uiviewcontroller super class.

- (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 } homecoming self; }

my template produce next entry u can utilize create controller 2 nibs.

iphone ios objective-c xcode ipad

No comments:

Post a Comment