Creating a Static Table View that has in a cell a UISegmentedCotrol and in another cell 3 views, how do i connect the segment to my views

StackOverflow https://stackoverflow.com/questions/21728859

Pergunta

I'm trying to create an app similar to AppStore detail view of an app , were you have a static table view and in one the cell is a segmented controller and i want when i change my value of the segmented controller to change the views that are in another cell. I'm a new developer for iOS. IF you need more information i'll try to be more specific about what i want, just let me know ,thank you for your help.

Foi útil?

Solução

Life is simpler with static table views. As you are defining your cells for your static table view, add your segmented control (UISegmentedControl, not segmented controller) onto the cell.

Then open the header for your table view's view controller in an assistant editor and control-drag from your segmented control into the header. That will offer to create an outlet or an action. Select an action. Make it triggered by a value changed event.

If you have more than one segmented control, have them link to the same action, and use a tag on the control to figure out which one is which.

I have a sample project on github that shows how to use buttons on a static table view (link) , which is very similar.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top