Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
407 views
in Technique[技术] by (71.8m points)

ios - Xcode 6 - Template without Storyboards

I know this sounds trivial, but I'm quite irritated with the lack of an 'empty' template for iOS apps in beta 3/4.

I detest the Storyboard approach, (IMO it's naive to assume that it's always the most elegant approach).

In fact for the majority of my use cases, Storyboards simply don't work.

Can anyone advise me on how I can take the empty template and get to a starting point (app delegate with a window) without SB's? - or migrate one of the other templates to non SB.

that prepare for segue method gives me shivers it's so ugly...

Thanks in advance.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I don't like Storyboards either.

Here is what I do to go from a SB-template to nice and clean 'from code design':

  • create a project from the single-view template (gives you the least storyboard 'boilerplaite')
  • delete the Storyboard
  • go to your AppDelegate(.m / .swift) and create a UIWindow through code in application:didFinishLaunchingWithOptions::

    CGRect screenBounds = [[UIScreen mainScreen] bounds];
    
    UIWindow *window = [[UIWindow alloc] initWithFrame:screenBounds];
    
    UIViewController *viewController = [[UIViewController alloc] init];
    [window setRootViewController:viewController];
    
    [window makeKeyAndVisible];
    
    [self setWindow:window];
    
  • remember to go select your target and delete the 'MainInterface' entry in 'General' under 'Deployment Info'

From this point on, you are ready to go and Xcode won't annoy you with SB anymore :)

Unfortunately, I haven't found a way to save a project as a template so far :/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...