Skip to content

Instantly share code, notes, and snippets.

@coneybeare
Created September 18, 2009 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coneybeare/189306 to your computer and use it in GitHub Desktop.
Save coneybeare/189306 to your computer and use it in GitHub Desktop.
////////////////////////////
// .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