Permalink
Browse files

[ios-sdk] Don't have ginormous stretched spinner in iOS 4.3.

Summary:
On iOS 4.3, the spinner being displayed in graph object table cells was a
MondoSpinner(tm) the width of the entire display. The world is not yet ready for
MondoSpinner(tm), so it is being replaced with a normal-size spinner. The autoresizing
mask flags apparently are interpreted differently on 4.3 and later iOSes. Fixed to not
autosize the spinner, but rather calculate where it should be placed and explicitly set
its center point.

Also cleaned up some math in FBUtility after discovering the CGRectGetMidX/Y function.

Test Plan:
- Ran place/friend picker samples on 4.3 and 5.0, verified that spinners are all normal size.

Revert Plan:

Reviewers: jacl, mmarucheck, gregschechte, ayden

Reviewed By: jacl

CC: platform-diffs@lists

Differential Revision: https://phabricator.fb.com/D495067

Task ID: 1123885
  • Loading branch information...
1 parent 7d21a16 commit ee02e4ded8c97b760d1bdb1523f8fa308f52c837 @clang13 clang13 committed Jun 14, 2012
Showing with 10 additions and 11 deletions.
  1. +6 −3 src/FBGraphObjectTableCell.m
  2. +4 −8 src/FBUtility.m
@@ -129,17 +129,20 @@ + (CGFloat)rowHeight
}
- (void)startAnimatingActivityIndicator {
+ CGRect cellBounds = self.bounds;
if (!self.activityIndicator) {
- UIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:self.bounds];
+ UIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
activityIndicator.hidesWhenStopped = YES;
- activityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;
activityIndicator.autoresizingMask =
- UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+ (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin);
self.activityIndicator = activityIndicator;
[self addSubview:activityIndicator];
[activityIndicator release];
}
+
+ self.activityIndicator.center = CGPointMake(CGRectGetMidX(cellBounds), CGRectGetMidY(cellBounds));
+
[self.activityIndicator startAnimating];
}
View
@@ -90,19 +90,15 @@ + (void)centerView:(UIView*)view tableView:(UITableView*)tableView
// We want to center the view in the table as much as possible, but we also want to center it
// within a cell so it is visually appealing.
CGRect bounds = tableView.bounds;
- CGPoint center = CGPointMake(bounds.origin.x + bounds.size.width / 2,
- bounds.origin.y + bounds.size.height / 2);
+ CGPoint center = CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds));
CGFloat rowHeight = tableView.rowHeight;
int numRows = bounds.size.height / rowHeight;
int centerRow = numRows / 2;
- CGFloat centerRowCenterY = rowHeight * centerRow + rowHeight / 2;
+ center.y = rowHeight * centerRow + rowHeight / 2;
- CGSize viewSize = view.bounds.size;
- bounds = CGRectMake(center.x - viewSize.width / 2, centerRowCenterY - viewSize.width / 2,
- viewSize.width, viewSize.height);
- bounds = [view.superview convertRect:bounds fromView:tableView];
- view.frame = bounds;
+ center = [view.superview convertPoint:center fromView:tableView];
+ view.center = center;
}
@end

0 comments on commit ee02e4d

Please sign in to comment.