Tuesday, 15 May 2012

iphone - Using subset of storyboard for a second target -



iphone - Using subset of storyboard for a second target -

i going ot develop total version, lite version , free version of app. (or 2 of them @ least)

in past, without storyboard, added target , set compiler variable , used #if/else/endif statements manage variances between versions. fine far.

this time used storyboard first time. has 50 view controllers. , facing question how deal that. total app tab bar based , lite version should go without tab bar (it cover not more functionality corresponding 1 of tabs of total version).

how can deal this? need sec storyboard? able reuse views storyboard #1 in storyboard #2 , #3? or can @ to the lowest degree utilize sec storyboard starting point , branch parts of storyboard #1? (again, lite app consist of functionality within 1 of tabs of total app).

frankly donnot know start. why cannot share have tried far. hint appreciated.

all right, found suitable way. although not totally happy because not looking for, works , provides me high grade of re-usage.

1) create new target in xcode.

2) xcode create sec set of storyboards.

3) storyboards have per default same names original ones reside in different (newly created xcode) , assigned 1 each target.i renamed because need both storyboards in sec target.. renaming not required if each target uses own storyboard only. in case should rename it. if rename need assign new name within target's project settings. works nicely.

4) in case storyboard free app consists of root view controller , 1 regluar view controller wich seves me main menu user. in case total app based on tabs , due reduced funktionality , more lean utilize case free app not.

5) main menu view controller segue programmatically view controllers of other story board. doing essential ids in storyboard set , unique (!). in case menu consists of number of buttons. each of them invokes ibaction. of course of study table instead etc.

- (ibaction)newminutes:(id)sender { // storyboard named secondstoryboard main bundle: uistoryboard *secondstoryboard = [uistoryboard storyboardwithname:@"mainstoryboard_iphone" bundle:nil]; // load view controller identifier string // alter uiviewcontroller appropriate class uiviewcontroller *thetabbar = (uiviewcontroller *)[secondstoryboard instantiateviewcontrollerwithidentifier:@"minutesmenu"]; // force new view controller in usual way: [self.navigationcontroller pushviewcontroller:thetabbar animated:yes]; }

6) 1 time view controller , running works nicely within own storyboard , segue subsequent view controllers etc.

7) however, @ place still need create variances. situations set 2 macros in each target's project settings. free , full macros. can compile different code, such programmatic segues, using #ifdef construct.

#ifdef total // #else // #endif

or

#ifdef free // #endif

hope, helps t.j. , others in same situation.

iphone ios xcode storyboard

No comments:

Post a Comment