Permalink
Browse files

Changed some code in fullsize tranform logic

  • Loading branch information...
1 parent 247d3bf commit 999ab4f29ec123cd480f09e45de1903dc0eadd7f @gmoledina committed Nov 6, 2011
Showing with 22 additions and 24 deletions.
  1. +13 −18 GMGridView/API/GMGridView.m
  2. +8 −5 GMGridView/API/GMGridViewCell.m
  3. +1 −1 GMGridView/ViewController.m
@@ -689,8 +689,8 @@ - (void)pinchGestureUpdated:(UIPinchGestureRecognizer *)pinchGesture
scale = MIN(scale, kMaxScale / currentScale);
scale = MAX(scale, kMinScale / currentScale);
- if (scale >= 0.5 && scale <= 3)
- {
+ //if (scale >= 0.5 && scale <= 3)
+ //{
CGAffineTransform currentTransform = [_transformingItem transform];
CGAffineTransform newTransform = CGAffineTransformScale(currentTransform, scale, scale);
_transformingItem.transform = newTransform;
@@ -701,7 +701,7 @@ - (void)pinchGestureUpdated:(UIPinchGestureRecognizer *)pinchGesture
{
[_transformingItem stepToFullsizeWithAlpha:1 - (2.5 - currentScale)];
}
- }
+ //}
break;
}
@@ -823,23 +823,17 @@ - (void)transformingGestureDidFinish
[_transformingItem addGestureRecognizer:pinch];
_transformingItem.transform = CGAffineTransformIdentity;
+ _transformingItem.frame = self.bounds;
[_transformingItem switchToFullSizeMode:YES];
+ _transformingItem.backgroundColor = [[UIColor darkGrayColor] colorWithAlphaComponent:0.7];
- [UIView animateWithDuration:kDefaultAnimationDuration
- animations:^{
- _transformingItem.frame = self.bounds;
- }
- completion:^(BOOL finished){
- _transformingItem.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
- _inFullSizeMode = YES;
-
- if ([self.transformDelegate respondsToSelector:@selector(GMGridView:didEnterFullSizeForView:)])
- {
- [self.transformDelegate GMGridView:self didEnterFullSizeForView:_transformingItem.contentView];
- }
-
- }
- ];
+ _transformingItem.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+ _inFullSizeMode = YES;
+
+ if ([self.transformDelegate respondsToSelector:@selector(GMGridView:didEnterFullSizeForView:)])
+ {
+ [self.transformDelegate GMGridView:self didEnterFullSizeForView:_transformingItem.contentView];
+ }
}
else
{
@@ -850,6 +844,7 @@ - (void)transformingGestureDidFinish
_transformingItem = nil;
transformingView.transform = CGAffineTransformIdentity;
+ transformingView.backgroundColor = [UIColor clearColor];
CGRect frameInScroll = [self convertRect:transformingView.frame toView:_scrollView];
@@ -170,11 +170,14 @@ - (void)switchToFullSizeMode:(BOOL)fullSizeEnabled
_inFullSizeMode = YES;
- [UIView animateWithDuration:0.1
+ self.fullSizeView.alpha = MAX(self.fullSizeView.alpha, self.contentView.alpha);
+ self.contentView.alpha = 0;
+
+ [UIView animateWithDuration:0.3
animations:^{
self.fullSizeView.alpha = 1;
- self.contentView.alpha = 0;
- self.backgroundColor = [UIColor clearColor];
+ self.fullSizeView.frame = CGRectMake(self.fullSizeView.frame.origin.x, self.fullSizeView.frame.origin.y, self.fullSize.width, self.fullSize.height);
+ self.fullSizeView.center = center;
}
completion:^(BOOL finished){
[self setNeedsLayout];
@@ -186,10 +189,10 @@ - (void)switchToFullSizeMode:(BOOL)fullSizeEnabled
self.fullSizeView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
_inFullSizeMode = NO;
+ self.fullSizeView.alpha = 0;
- [UIView animateWithDuration:0.1
+ [UIView animateWithDuration:0.3
animations:^{
- self.fullSizeView.alpha = 0;
self.contentView.alpha = 1;
self.fullSizeView.frame = self.bounds;
}
@@ -258,7 +258,7 @@ - (CGSize)GMGridView:(GMGridView *)gridView sizeInFullSizeForView:(UIView *)view
}
else
{
- return CGSizeMake(700, 700);
+ return CGSizeMake(700, 530);
}
}

0 comments on commit 999ab4f

Please sign in to comment.