Permalink
Browse files

fixed endless loop in layout subviews if the title is too long

  • Loading branch information...
renep committed Feb 22, 2013
1 parent 75f504f commit a6ea2267e813195007aa26140460cd9538fcaf64
Showing with 12 additions and 13 deletions.
  1. +12 −13 Core/Source/iOS/DTActivityTitleView.m
@@ -54,19 +54,6 @@ - (id)init
- (void)layoutSubviews
{
[super layoutSubviews];
-
- CGFloat gap = 5.0;
- CGFloat height = self.activityIndicator.frame.size.height;
- CGSize neededSize = [self.titleLabel.text sizeWithFont:self.titleLabel.font];
-
- if (height < neededSize.height)
- {
- height = neededSize.height;
- }
-
- CGRect titleRect = CGRectMake(self.activityIndicator.frame.size.width+gap, 0, neededSize.width, height);
- self.titleLabel.frame = titleRect;
- self.bounds = CGRectMake(0, 0, self.activityIndicator.frame.size.width+neededSize.width+gap, height);
}
#pragma mark - Properties
@@ -93,6 +80,18 @@ - (BOOL)busy
- (void)setTitle:(NSString *)title
{
self.titleLabel.text = title;
+ CGFloat gap = 5.0;
+ CGFloat height = self.activityIndicator.frame.size.height;
+ CGSize neededSize = [self.titleLabel.text sizeWithFont:self.titleLabel.font];
+
+ if (height < neededSize.height)
+ {
+ height = neededSize.height;
+ }
+
+ CGRect titleRect = CGRectMake(self.activityIndicator.frame.size.width+gap, 0, neededSize.width, height);
+ self.titleLabel.frame = titleRect;
+ self.bounds = CGRectMake(0, 0, self.activityIndicator.frame.size.width+neededSize.width+gap, height);
[self setNeedsLayout];
}

0 comments on commit a6ea226

Please sign in to comment.