-
-
Save tjweir/152022 to your computer and use it in GitHub Desktop.
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
// | |
// EGOTitledTableViewCell.h | |
// EGOClasses | |
// | |
// Created by Shaun Harrison on 6/2/09. | |
// Copyright 2009 enormego. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
@interface EGOTitledTableViewCell : UITableViewCell { | |
@private | |
UILabel* titleLabel; | |
UILabel* textLabel; | |
} | |
@property(nonatomic,copy) NSString* title; | |
@property(nonatomic,readonly) UILabel* titleLabel; | |
@property(nonatomic,readonly) UILabel* textLabel; | |
@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
// | |
// EGOTitledTableViewCell.m | |
// EGOClasses | |
// | |
// Created by Shaun Harrison on 6/2/09. | |
// Copyright 2009 enormego. All rights reserved. | |
// | |
#import "EGOTitledTableViewCell.h" | |
@implementation EGOTitledTableViewCell | |
@synthesize titleLabel, textLabel; | |
- (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier { | |
if (self = [super initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 44.0f) reuseIdentifier:reuseIdentifier]) { | |
float titleWidth = floor(self.contentView.frame.size.width * .30); | |
float textWidth = self.contentView.frame.size.width - titleWidth - 10.0f; | |
titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0f, 0.0f, titleWidth, self.contentView.frame.size.height)]; | |
titleLabel.autoresizingMask = UIViewAutoresizingFlexibleHeight; | |
titleLabel.backgroundColor = [UIColor clearColor]; | |
titleLabel.highlightedTextColor = [UIColor whiteColor]; | |
titleLabel.font = [UIFont boldSystemFontOfSize:13.0f]; | |
titleLabel.textColor = [UIColor grayColor]; | |
titleLabel.textAlignment = UITextAlignmentRight; | |
textLabel = [[UILabel alloc] initWithFrame:CGRectMake(titleWidth+10.0f, 0.0f, textWidth, self.contentView.frame.size.height)]; | |
textLabel.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; | |
textLabel.backgroundColor = [UIColor clearColor]; | |
textLabel.highlightedTextColor = [UIColor whiteColor]; | |
textLabel.font = [UIFont boldSystemFontOfSize:17.0f]; | |
[self.contentView addSubview:titleLabel]; | |
[self.contentView addSubview:textLabel]; | |
} | |
return self; | |
} | |
- (void)setText:(NSString*)text { | |
textLabel.text = text; | |
} | |
- (NSString*)text { | |
return textLabel.text; | |
} | |
- (void)setTitle:(NSString*)title { | |
titleLabel.text = title; | |
} | |
- (NSString*)title { | |
return titleLabel.text; | |
} | |
- (void)setSelected:(BOOL)selected animated:(BOOL)animated { | |
[super setSelected:selected animated:animated]; | |
// Configure the view for the selected state | |
} | |
- (void)dealloc { | |
[titleLabel release]; | |
[textLabel release]; | |
[super dealloc]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment