捏时,UIImageView的检查大小小于原始大小

时间:2012-01-13 02:29:52

标签: iphone objective-c ipad uitapgesturerecognizer

所以我已经加载了一个UIImageView并且里面有一个PinchGestureRecognizer,现在的问题是如何检测UIImageView的大小是否小于原始大小(在它被压缩之前)?我现在这样做是这样的:

- (IBAction)resizeImage:(UIPinchGestureRecognizer *)sender
{
    UIImageView * imgView = (UIImageView *)[fullSizeImageView.subviews objectAtIndex:0];

    sender.view.transform = CGAffineTransformScale(sender.view.transform, sender.scale, sender.scale);

    NSLog(@"SCALE IS %f WITH STATE %d", sender.scale, sender.state);
    if (imgView.frame.size.width < oriWidth && imgView.frame.size.height < oriHeight) {
       //then it's size is smaller than original
    }
}

我想知道是否有更好的方法来做到这一点?

1 个答案:

答案 0 :(得分:1)

由于您只是根据UIPinchGestureRecognizer的比例缩放UIImageView,因此缩放值不会< 1.0意味着UIImageView比原来小吗?