Skip to content

Commit

Permalink
Fixes kevingibbon#7: Misaligned UILabel in status bar
Browse files Browse the repository at this point in the history
  • Loading branch information
ChocoChipset committed Mar 9, 2013
1 parent 70626c5 commit 203431b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions KGStatusBar/KGStatusBar.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ - (void)showWithStatus:(NSString *)status barColor:(UIColor*)barColor textColor:
CGSize stringSize = [labelText sizeWithFont:self.stringLabel.font constrainedToSize:CGSizeMake(self.topBar.frame.size.width, self.topBar.frame.size.height)];
stringWidth = stringSize.width;
stringHeight = stringSize.height;

labelRect = CGRectMake((self.topBar.frame.size.width / 2) - (stringWidth / 2), 0, stringWidth, stringHeight);
float labelXOffset = floorf(((self.topBar.frame.size.width - stringWidth) / 2.0f) + 0.5f); // avoiding missaligned images
labelRect = CGRectMake(labelXOffset, 0, stringWidth, stringHeight);
}
self.stringLabel.frame = labelRect;
self.stringLabel.alpha = 0.0;
Expand Down

0 comments on commit 203431b

Please sign in to comment.