Is there a way that I can achieve this in iOS.
for example when a user switch on a switch the view will automatically unhide itself or vice versa.
*(UITextField) (Switch)
-(UITextField) //this is the view that will be hidden/unhidden
-(UITextField) //this is the view that will be hidden/unhidden
I hope someone can help me.
Yes, you can hide / unhide views on tap on a switch. For example, you can use
UIButton
as a switch and hide your views in the implementation of an action method.Here's a good tutorial which would help you to get started with
UIButton
and handling actions.Alternatively, you can achieve the same using
UISwitch
instead. You may find this tutorial useful.Update: If you want to "expand" your subview, just update accordingly
frame
property of that particular subview.