ios - How to not display data in first component of UIPickerView until the start of specific row in second component? -


i apologize if duplicate of following questions, if please mark so:

how set data in second component based on first component selection in uipickerview not able reload second compoenent based on value in first component in uipickerview

first, illustration of have in uipickerview: enter image description here

i have 2 components in uipickerview. first component not show until row 3 of second component selected, i.e. day(s).

i have following simple code set up:

func pickerview(_ pickerview: uipickerview, titleforrow row: int, forcomponent component: int) -> string? {     if component == 0     {         return times_array[row]     }     else     {         return cycle_array[row]     } }  func pickerview(_ pickerview: uipickerview, numberofrowsincomponent component: int) -> int {     if component == 0     {          return times_array.count     }     else     {         return cycle_array.count     } } 

i'm sure it's obvious, i'm not sure how apply simple logic.

can point me in right direction?

thanks

declare global variable dayselcted:bool , change these 2 delegate methods.

var dayselcted:bool = false  func pickerview(_ pickerview: uipickerview, numberofrowsincomponent component: int) -> int {     if component == 0     {         if !dayselcted         {         return 0         }         return times_array.count     }     else     {         return cycle_array.count     } }      func pickerview(_ pickerview: uipickerview, didselectrow row: int, incomponent component: int) {     if component == 1      {         if row == 2         {         dayselcted = true         }         else         {             dayselcted = false         }         pickerview.reloadcomponent(0)      }  } 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -