您的位置:首页 > 其它

Converting to Storyboards Release Notes

2013-01-12 20:42 399 查看
StoryboardingisanewwaytocreateuserinterfacesforiOSapplications,beginningwithiOS5andXcode4.2.Usingstoryboards,youcandesigntheviewcontrollersthatcomposeyourapplicationasscenesintheXcodedesigncanvasandvisuallydefinethenavigationbetweenthescenesusingsegues.

ThereareafewstepsyouneedtotaketoconvertanexistingiOSapplicationprojecttousestoryboards.Inaddition,thereareothernewpatternsyoucanadopt.

ConfiguretheApplicationDelegate

Theapplicationdelegateisresponsibleforloadingthestoryboardandmanagingthewindow.Youneedtospecifythenameoftheapplicationdelegateclassin
UIApplicationMain
,andensurethattheapplicationdelegatehasapropertycalled
window
.Ifyoudon’thaveanexistingapplicationdelegateclass,youneedtocreateone.Aminimalimplementationwouldlooklikethis:Listing1-1Minimalapplicationdelegateheaderfile
#import<UIKit/UIKit.h>
@interfaceAppDelegate:NSObject<UIApplicationDelegate>
@property(strong,nonatomic)UIWindow*window;
@end
Listing1-2Minimalapplicationdelegateimplementationfile
#import"AppDelegate.h"
@implementationAppDelegate
@synthesizewindow=_window;
@end
Inthe
main.m
file,settheapplicationdelegateclassin
UIApplicationMain
.Yourexistingmain.mfileprobablylookssomethinglikethis:
#import<UIKit/UIKit.h>
intmain(intargc,char*argv[]){
NSAutoreleasePool*pool=[[NSAutoreleasePoolalloc]init];
intretVal=UIApplicationMain(argc,argv,nil,nil);
[poolrelease];
returnretVal;
}
Changeittolooklikethis:
#import<UIKit/UIKit.h>
#import"AppDelegate.h"
intmain(intargc,char*argv[]){
@autoreleasepool{
returnUIApplicationMain(argc,argv,nil,NSStringFromClass([AppDelegateclass]));
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: