ios - How Do we recall PickView's didSelectRow after choosing a segment? -


i have used segmented control user choose between 2 type of results after select row in pickerview. however, when choose row in pickerview shows result of selected segment, select segment doesn't until reselect row again.

here code:

- (void)pickerview:(uipickerview *)thepickerview didselectrow:(nsinteger)row incomponent:(nsinteger)component {  i=row; switch (i) {     case 0:   case 1 if(_segment.selectedsegmentindex == 1){          [self fquarter];         [self tquarter];         [self ten];         [self twenty];         [self fourty];         [self fifty];           nslog(@"audio 10 mins");         }          if(_segment.selectedsegmentindex == 0){              [self sfquarter];             [self stquarter];             [self sten];             [self stwenty];             [self sfourty];             [self sfifty];               nslog(@"visual 10 mins");         } 

and it's every case, did miss?

i think need call method has [self fquarter], etc. statements both picker delegate method, , action method segmented control. (pickerselectedrow property typed nsinteger):

@interface viewcontroller () @property (weak,nonatomic) iboutlet uisegmentedcontrol *segment; @property (nonatomic) nsinteger pickerselectedrow; @end  @implementation viewcontroller  - (void)viewdidload {     [super viewdidload];     // additional setup after loading view, typically nib. }  - (void)pickerview:(uipickerview *)thepickerview didselectrow:(nsinteger)row incomponent:(nsinteger)component {     self.pickerselectedrow = row;     [self dostuff];  }  -(ibaction)segmentchosen:(uisegmentedcontrol *)sender {     [self dostuff]; }   -(void)dostuff {     switch (self.pickerselectedrow) {         case 0:          case 1:             if(_segment.selectedsegmentindex == 1){                  [self fquarter];                 [self tquarter];                 [self ten];                 [self twenty];                 [self fourty];                 [self fifty];                   nslog(@"audio 10 mins");             }              if(_segment.selectedsegmentindex == 0){                  [self sfquarter];                 [self stquarter];                 [self sten];                 [self stwenty];                 [self sfourty];                 [self sfifty];                  nslog(@"visual 10 mins");             }       } } 

with type of arrangement, method set values called either when picker view value changes or segmented control's value changes.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -