Avoiding to add a margin to the arrow when the title text is empty. This will make the arrow centralized in the screen when there is no text.

This commit is contained in:
michelzanini
2013-09-25 15:23:23 +01:00
parent 5b98a05001
commit e424e6523d

View File

@@ -289,7 +289,14 @@ static char UIScrollViewPullToRefreshView;
lineBreakMode:self.subtitleLabel.lineBreakMode];
CGFloat maxLabelWidth = MAX(titleSize.width,subtitleSize.width);
CGFloat totalMaxWidth = leftViewWidth + margin + maxLabelWidth;
CGFloat totalMaxWidth;
if (maxLabelWidth) {
totalMaxWidth = leftViewWidth + margin + maxLabelWidth;
} else {
totalMaxWidth = leftViewWidth + maxLabelWidth;
}
CGFloat labelX = (self.bounds.size.width / 2) - (totalMaxWidth / 2) + leftViewWidth + margin;
if(subtitleSize.height > 0){