Created
July 26, 2011 17:40
-
-
Save hatfinch/1107320 to your computer and use it in GitHub Desktop.
Autogenerated ivars not retained by ARC
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
@interface OLVIconViewCell : UIView | |
@property(nonatomic, readonly) NSString *reuseIdentifier; | |
@property(nonatomic, readonly) UILabel *textLabel; | |
@property(nonatomic, readonly) UILabel *detailTextLabel; | |
@property(nonatomic, readonly) UIImageView *imageView; | |
- (id)initWithReuseIdentifier:(NSString *)identifier; | |
- (void)prepareForReuse; | |
@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
#import "OLVIconViewCell.h" | |
@interface OLVIconViewCell () | |
{ | |
// UILabel *myTextLabel; | |
// UILabel *myDetailTextLabel; | |
// UIImageView *myImageView; | |
// NSString *myReuseIdentifier; | |
CGSize mySize; | |
} | |
@end | |
@implementation OLVIconViewCell | |
@synthesize reuseIdentifier = myReuseIdentifier; | |
@synthesize textLabel = myTextLabel, detailTextLabel = myDetailTextLabel, imageView = myImageView; | |
- (UILabel *)cellLabel | |
{ | |
UILabel *label = [[UILabel alloc] init]; | |
label.shadowOffset = CGSizeMake(0.0, 1.0); | |
label.textAlignment = UITextAlignmentCenter; | |
return label; | |
} | |
- (id)initWithReuseIdentifier:(NSString *)identifier | |
{ | |
self = [super initWithFrame:CGRectZero]; | |
if (self) | |
{ | |
myReuseIdentifier = identifier; | |
myTextLabel = [self cellLabel]; | |
myTextLabel.textColor = [UIColor whiteColor]; | |
myDetailTextLabel = [self cellLabel]; | |
myDetailTextLabel.textColor = [UIColor lightGrayColor]; | |
myImageView = [[UIImageView alloc] init]; | |
} | |
return self; | |
} | |
- (void)prepareForReuse | |
{ | |
} | |
- (void)performLayout | |
{ | |
CGSize size = self.bounds.size; | |
CGSize textSize = [myTextLabel sizeThatFits:size]; | |
CGSize detailTextSize = [myDetailTextLabel sizeThatFits:size]; | |
myDetailTextLabel.Frame = CGRectMake(0.0, size.height - detailTextSize.height, size.width, detailTextSize.height); | |
myTextLabel.frame = CGRectMake(0.0, size.height - detailTextSize.height - textSize.height, size.width, textSize.height); | |
myImageView.frame = CGRectMake(0.0, 0.0, size.width, size.height - textSize.height - detailTextSize.height); | |
} | |
- (void)setFrame:(CGRect)frame | |
{ | |
[super setFrame:frame]; | |
if (!CGSizeEqualToSize(frame.size, mySize)) | |
{ | |
mySize = frame.size; | |
[self performLayout]; | |
} | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment