I found this great sample code about 'Switching Views with a UISegmentedControl'.
http://redartisan.com/blog?page=2
(sample code link : http://github.com/crafterm/SegmentedControlRevisited)
but this sample code is using xib. I want to re-coding it using storyboard (no xib). Is anywhere similar sample code?
I did a little trick to be able to do that within the Storyboard.
I have a SplitView Controller with a Master and a Detail view. I created two simple View Controllers with size equal to Detail. Both of them have a Segmented Control with the same two buttons: First and Second. On each view, I added a label representing that View ("First View" and "Second View").
Then, on the first View, I select the "First" button and on the second View, I select the "Second" button.
After that, the only thing remaining is to create segues between them (First View goes to the second and the Second View goes to the First). The type of segue for both of them is "replace".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With