Skip to content

Commit

Permalink
Merge pull request cruffenach#134 from dmiedema/activityIndicatorCenter
Browse files Browse the repository at this point in the history
Fix Activity Indicator center alignment being shifted left
  • Loading branch information
Ashton-W committed Feb 15, 2015
2 parents 583da45 + 5c3ea65 commit 74dd964
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions CRToast/CRToastView.m
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static CGFloat CRCenterXForActivityIndicatorWithAlignment(CRToastAccessoryViewAl
case CRToastAccessoryViewAlignmentLeft:
center = offset; break;
case CRToastAccessoryViewAlignmentCenter:
center = (contentWidth / 2) - offset; break;
center = (contentWidth / 2); break;
case CRToastAccessoryViewAlignmentRight:
center = contentWidth - offset; break;
}
Expand Down Expand Up @@ -140,7 +140,7 @@ - (void)layoutSubviews {
0 :
CGRectGetHeight(contentFrame));

CGFloat imageWidth = imageSize.width == 0 ? kCRStatusBarViewNoImageLeftContentInset : CGRectGetMaxX(_imageView.frame);
CGFloat imageWidth = imageSize.width == 0 ? 0 : CGRectGetMaxX(_imageView.frame);
CGFloat x = CRContentXOffsetForViewAlignmentAndWidth(self.toast.imageAlignment, imageWidth);

if (self.toast.showActivityIndicator) {
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit Tests/CRToastViewTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ - (void)testActivityFrameCenterAlignment {
toast.options = options;
self.view.toast = toast;

CGPoint assumedCenter = CGPointMake(100, 50);
CGPoint assumedCenter = self.view.center;

[self.view layoutSubviews];

Expand Down

0 comments on commit 74dd964

Please sign in to comment.