Created
September 18, 2009 21:35
-
-
Save coneybeare/189306 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
//////////////////////////// | |
// .h file | |
#import <UIKit/UIKit.h> | |
@interface DemoTableViewCell : UITableViewCell { | |
} | |
@end | |
//////////////////////////// | |
// .m file | |
#import "DemoTableViewCell.h" | |
#define MARGIN 10 | |
@implementation DemoTableViewCell | |
- (void) layoutSubviews { | |
[super layoutSubviews]; | |
CGRect cvf = self.contentView.frame; | |
self.imageView.frame = CGRectMake(0.0, | |
0.0, | |
cvf.size.height-1, | |
cvf.size.height-1); | |
self.imageView.contentMode = UIViewContentModeScaleAspectFit; | |
CGRect frame = CGRectMake(cvf.size.height + MARGIN, | |
self.textLabel.frame.origin.y, | |
cvf.size.width - cvf.size.height - 2*MARGIN, | |
self.textLabel.frame.size.height); | |
self.textLabel.frame = frame; | |
frame = CGRectMake(cvf.size.height + MARGIN, | |
self.detailTextLabel.frame.origin.y, | |
cvf.size.width - cvf.size.height - 2*MARGIN, | |
self.detailTextLabel.frame.size.height); | |
self.detailTextLabel.frame = frame; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment