Skip to content

Commit

Permalink
Fixes more issues with label layout
Browse files Browse the repository at this point in the history
  • Loading branch information
escoz committed Oct 3, 2013
1 parent 69397d9 commit 78f2276
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
12 changes: 6 additions & 6 deletions quickdialog/QTableViewCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ - (void)layoutSubviews
{
[super layoutSubviews];

CGSize imageSize = CGSizeZero;
if (self.imageView!=nil)
imageSize = self.imageView.frame.size;

CGSize sizeWithMargin = self.contentView.bounds.size;

if (self.imageView.image!=nil){
sizeWithMargin = CGSizeMake(sizeWithMargin.width - self.imageView.image.size.width - kCellMarginDouble, sizeWithMargin.height);
}

if (_labelingPolicy == QLabelingPolicyTrimTitle)
{
if (self.textLabel.text!=nil){
Expand All @@ -51,7 +51,7 @@ - (void)layoutSubviews
self.textLabel.frame = CGRectMake(
self.textLabel.frame.origin.x,
kCellMargin,
self.contentView.bounds.size.width - valueSize.width - imageSize.width - kCellMarginDouble - kCellMarginDouble,
self.contentView.bounds.size.width - valueSize.width - kCellMarginDouble - kCellMarginDouble,
self.contentView.bounds.size.height- kCellMarginDouble);

self.detailTextLabel.frame = CGRectMake(
Expand All @@ -78,7 +78,7 @@ - (void)layoutSubviews
valueSize.width,
self.contentView.bounds.size.height- kCellMarginDouble);

CGFloat detailsWidth = self.contentView.bounds.size.width - imageSize.width - kCellMarginDouble;
CGFloat detailsWidth = self.contentView.bounds.size.width - kCellMarginDouble;
if (valueSize.width>0)
detailsWidth = detailsWidth - valueSize.width - kCellMarginDouble;

Expand Down
8 changes: 6 additions & 2 deletions sample/SampleDataBuilder.m
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,10 @@ + (QRootElement *)createLabelsRoot {
b1.image = [UIImage imageNamed:@"intel"];
[secImg addElement:b1];

QLabelElement *b4 = [[QLabelElement alloc] initWithTitle:@"Processor processor processor processor processor processor processor" Value:nil];
b4.image = [UIImage imageNamed:@"intel"];
[secImg addElement:b4];

QLabelElement *b2 = [[QLabelElement alloc] initWithTitle:@"iPhone" Value:@"OK"];
b2.image = [UIImage imageNamed:@"iPhone"];
[secImg addElement:b2];
Expand All @@ -472,8 +476,8 @@ + (QRootElement *)createLabelsRoot {
QSection *sec = [[QSection alloc] initWithTitle:@"Jazzin.."];
[badge3 addSection:sec];

QBadgeElement *b4 = [[QBadgeElement alloc] initWithTitle:@"With a really really really long title" Value:@"YEAH"];
[s2 addElement:b4];
QBadgeElement *b5 = [[QBadgeElement alloc] initWithTitle:@"With a really really really long title" Value:@"YEAH"];
[s2 addElement:b5];

[s2 addElement:badge3];
[sec addElement:[[QBadgeElement alloc] initWithTitle:@"Test" Value:@"0"]];
Expand Down

0 comments on commit 78f2276

Please sign in to comment.