forked from facebookarchive/three20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Render badges using the new style system
* Use the style box model to calculate the size of styled views * Re-organized the xcode project a bit
- Loading branch information
Showing
24 changed files
with
403 additions
and
137 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#import "Three20/TTBadgeView.h" | ||
#import "Three20/TTDefaultStyleSheet.h" | ||
|
||
/////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
@implementation TTBadgeView | ||
|
||
@synthesize message = _message; | ||
|
||
/////////////////////////////////////////////////////////////////////////////////////////////////// | ||
// NSObject | ||
|
||
- (id)initWithMessage:(NSString*)message { | ||
if (self = [self initWithFrame:CGRectZero]) { | ||
self.message = message; | ||
} | ||
return self; | ||
} | ||
|
||
- (id)initWithFrame:(CGRect)frame { | ||
if (self = [super initWithFrame:frame]) { | ||
_message = nil; | ||
|
||
self.style = TTSTYLE(badge); | ||
self.backgroundColor = [UIColor clearColor]; | ||
} | ||
return self; | ||
} | ||
|
||
- (void)dealloc { | ||
[_message release]; | ||
[super dealloc]; | ||
} | ||
|
||
/////////////////////////////////////////////////////////////////////////////////////////////////// | ||
// TTStyleDelegate | ||
|
||
- (NSString*)textForLayerWithStyle:(TTStyle*)style { | ||
return _message; | ||
} | ||
|
||
/////////////////////////////////////////////////////////////////////////////////////////////////// | ||
// public | ||
|
||
- (void)setMessage:(NSString*)message { | ||
if (message != _message) { | ||
[_message release]; | ||
_message = [message copy]; | ||
[self setNeedsDisplay]; | ||
} | ||
} | ||
|
||
@end |
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
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
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
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
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
Oops, something went wrong.