How exactly does an iPhone user interface object work?
I set about designing my own class to hold a series of radio buttons. In doing this, I explored how apple created their own classes, but struggled to work out exactly how things such as UILabel or UIB开发者_开发技巧utton worked.
Looking at UILabel.h, in UIKit.framework, I found a lot of definitions, but no methods per se. I'm quite new to iOS programming, but I assume there would have been a .m file expanding on how methods such as setTitleForIndex and so on actually work, but I couldn't find such a file.
I'm sure there's a lovely document somewhere explaining all of this, but I've failed to find it.
If anybody wants to explain how UILabel works, or could point me in the right direction, I'd be very grateful. I understand how to use a UILabel (as in set/get the text, change font, change numberOfLines, etc.) but not how to make something like UILabel from scratch.
Many thanks,
Tim
All user interface elements are subclasses of UIView (which is a subclass of UIResponder). examples include labels, buttons, sliders etc..(all UIViews or just Views). Each UI inherit event handling functionality from UIResponder (touches taps drags etc). and each specific UI element inherits drawing functionality from UIView.
Here is apple's View programming guide:
http://developer.apple.com/library/mac/#documentation/cocoa/conceptual/CocoaViewsGuide/Introduction/Introduction.html
精彩评论