I’m a beginner with Objective-C and have a question regarding creating a custom look and feel text box. I want to be able to create a text box area that has, for example a header with a label and different background color etc. where the text input appears. How does one go about doing such a thing in Objective-C? Is it a matter of just creating a custom class that has a UILabel with specific coordinates on top of the UITextBox? Let me know if someone can point me in the right direction. Thanks.
I’m a beginner with Objective-C and have a question regarding creating a custom look
Share
One option is to create a custom view that contains a UITextField and UILabel as sub-views. After that, the view can be re-used.
I highly recommend reading the View Programming Guide @ Apple: http://developer.apple.com/library/ios/#DOCUMENTATION/WindowsViews/Conceptual/ViewPG_iPhoneOS/Introduction/Introduction.html
A related post on creating an aggregate custom view: .Net UserControl XCode equivalent
Here’s one tutorial on creating a custom view:
http://www.raywenderlich.com/1768/how-to-make-a-custom-uiview-a-5-star-rating-view
You can also look at how other custom controls are built. Many of the controls at cocoacontrols.com are open sourced: http://www.cocoacontrols.com/