I am new to iOS programming and I am working with XCode learning storyboards. My question is
I have added the views that I want using the IB but I dont want to them to connect to my ViewController using Ctrl+Drag in the IB but do the same programmatically.
I have seens posts suggesting to create instances of the views in code and add them (by setting frame) using addSubView(). But I dont want to hardcode my frame and sizes in code, I prefer IB for that. I only need to refer to them when I need.
In android, we can do the same by getIdByName() on the layout XML. I am looking for something similar.
Thanks
In IB you can set the
Tagproperty of the view and then reference it in code by using:Tags are just an
int, you can have as many of them as you like. Note that if you have the same tag on 2 different views within one heirarchy, the behaviour is undefined and it will grab the first one of these it finds.