Skip to content

Commit

Permalink
Merge pull request #4188 from vishalduggal/timob-13243
Browse files Browse the repository at this point in the history
[TIMOB-13243] iOS: center wrapperview when required
  • Loading branch information
srahim committed Apr 22, 2013
2 parents c9e1673 + 1b543ba commit e0add7c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions iphone/Classes/TiUIScrollView.m
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ -(void)handleContentSize
wrapperBounds.origin = CGPointZero;
wrapperBounds.size = newContentSize;
[wrapperView setFrame:wrapperBounds];
[self scrollViewDidZoom:scrollView];
needsHandleContentSize = NO;
[(TiUIScrollViewProxy *)[self proxy] layoutChildrenAfterContentSize:NO];
}
Expand Down Expand Up @@ -400,14 +401,14 @@ - (void)scrollViewDidZoom:(UIScrollView *)scrollView_
{
CGSize boundsSize = scrollView.bounds.size;
CGRect frameToCenter = wrapperView.frame;
if (TiDimensionIsAuto(contentWidth) || TiDimensionIsAutoSize(contentWidth)) {
if (TiDimensionIsAuto(contentWidth) || TiDimensionIsAutoSize(contentWidth) || TiDimensionIsUndefined(contentWidth)) {
if (frameToCenter.size.width < boundsSize.width) {
frameToCenter.origin.x = (boundsSize.width - frameToCenter.size.width) / 2;
} else {
frameToCenter.origin.x = 0;
}
}
if (TiDimensionIsAuto(contentHeight) || TiDimensionIsAutoSize(contentHeight)) {
if (TiDimensionIsAuto(contentHeight) || TiDimensionIsAutoSize(contentHeight) || TiDimensionIsUndefined(contentHeight)) {
if (frameToCenter.size.height < boundsSize.height) {
frameToCenter.origin.y = (boundsSize.height - frameToCenter.size.height) / 2;
} else {
Expand Down

0 comments on commit e0add7c

Please sign in to comment.