Created
August 12, 2014 20:22
-
-
Save jazzychad/80d175951ffba5218940 to your computer and use it in GitHub Desktop.
Snippet for UIViews which visually represent an object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)dealloc | |
{ | |
[[NSNotificationCenter defaultCenter] removeObserver:self]; | |
} | |
- (void)layoutSubviews | |
{ | |
[super layoutSubviews]; | |
} | |
- (void)_updateUIFor<#Property#> | |
{ | |
} | |
- (void)set<#Property#>:(<#class#> *)<#parameter#> | |
{ | |
if (<#ivar#> != <#parameter#>) { | |
if (<#ivar#>) { | |
[[NSNotificationCenter defaultCenter] removeObserver:self name:<#NotifName#> object:<#ivar#>]; | |
} | |
<#ivar#> = <#parameter#>; | |
if (<#ivar#>) { | |
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(<#ivar#>DidUpdate:) name:<#NotifName#> object:<#ivar#>]; | |
} | |
[self _updateUIFor<#Property#>]; | |
} | |
} | |
- (void)<#ivar#>DidUpdate:(NSNotification *)note | |
{ | |
[self _updateUIFor<#Property#>]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment