emailconfirmed, nsInternRO, nsInternRW, Administrators
3,356
edits
No edit summary |
|||
(One intermediate revision by the same user not shown) | |||
Line 28: | Line 28: | ||
== Subclassing == | == Subclassing == | ||
Sometimes there are simpler ways to get notified of certain events. For example, there are some methods in | Sometimes there are simpler ways to get notified of or to react to certain events. For example, there are some methods in UIViewController that can be overridden by subclasses: | ||
<source lang="objc"> | |||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation; | |||
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration; | |||
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration; | |||
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation; | |||
</source> | |||
== Delegation & Notification == | == Delegation & Notification == | ||
Line 38: | Line 41: | ||
Whereas notifications are usually broadcasted into the wide open space (not necessarily restricted to the app itself!) for interested listeners. It's pretty unsure if anyone is receiving this. Also, the message is handled by the notification center. Think about it like a news mailing by post or an electronic mailing list, where you don't know who's reading it and when it's received. In fact, chances are high, most objects will be notified the next run loop. | Whereas notifications are usually broadcasted into the wide open space (not necessarily restricted to the app itself!) for interested listeners. It's pretty unsure if anyone is receiving this. Also, the message is handled by the notification center. Think about it like a news mailing by post or an electronic mailing list, where you don't know who's reading it and when it's received. In fact, chances are high, most objects will be notified the next run loop. | ||
[[Image:Messaging.png|420px]] | [[Image:Messaging.png|420px|left]] | ||
<br clear="all"/> | |||
You will find delegates all over the place. Important Delegate protocols are (just to name a few): | You will find delegates all over the place. Important Delegate protocols are (just to name a few): |