Reusable Views in iOS
Say you want to create a UIView
that you’re going to display in multiple places in your app.
Maybe you want to design a custom UITableViewCell
or AQGridViewCell
. Or maybe you want to create a view controller that can be displayed by several different view controllers in your app. Or maybe you want to create a custom UI widget that shows up multiple times in a view.
Does this mean you have to make the view programmatically? Is it time to break out the setFrame
and the addSubview
and the setTextColor
and the addTarget:action:forControlEvents:
?
Nope! You can still design your views in Interface Builder. Here’s how.