I am working on an iPhone app. This app is having many views in which address should show in more than 3 views. Other than creating xib, is there any way to build user defined control like address with events for iPhone in xcode.
Asked
Active
Viewed 73 times
1 Answers
0
You can easily create subclass of UIView
to create your own UIView
control. You could also subclass UIControl
if you like. Then you should implement the functionality of the control inside the created subclass.
Once you have your own UIView
subclass ready, you can place it in either Storyboard or Interface Builder and choose the class of the control. Just be careful that if you subclass UIView
, you also place UIView
on screen. Or you can place those in code.
More information about subclassing on links below:
- https://developer.apple.com/library/ios/documentation/uikit/reference/uiview_class/uiview/uiview.html
- http://www.raywenderlich.com/1768/uiview-tutorial-for-ios-how-to-make-a-custom-uiview-in-ios-5-a-5-star-rating-view
- Proper practice for subclassing UIView?
There is no other way of defining your own custom control in Xcode, apart from creating .xib.