XCode 4.2 + iOS 5 Storyboard : Can't distinguish between segmented control sections as segue initiators? -
using xcode 4.2 storyboard, i've created segmented control in view 2 segments. ctrl-drag each segment separate view create 2 segues. seems developers forgot distinguish between segments though, since 1 segue can created; attempting create second 'other' control segment cause first segue replaced second. have storyboard workaround this, or must write code manually?
thank you.
4.2 has been publicly release now.
the problem can solved storyboard using custom segue. in custom segue segmented control can tested determine controller call. have tested following custom segue:
#import "fliptoppop.h" @interface uiviewcontroller (extension) @property (strong, nonatomic) iboutlet uisegmentedcontrol *tabcontrol; @end @implementation fliptoppop - (void) perform { uiviewcontroller *src = (uiviewcontroller *) self.sourceviewcontroller; switch (src.tabcontrol.selectedsegmentindex) { case 0: // go settings src.tabcontrol.selectedsegmentindex = 1; //not yet implemented - don't segway - reset index 1 break; case 1: // controller called index 1 - nothing - should not here break; case 2: { [uiview transitionwithview:src.navigationcontroller.view duration:0.5 options:uiviewanimationoptiontransitionflipfromtop animations:^{ [src.navigationcontroller popviewcontrolleranimated:no]; } completion:null]; } break; default: break; } } @end
note have not yet implemented transition in case 0 (segment 0) transition controller code similar implemented in case 2.
Comments
Post a Comment