0
1)我在UIImageView上縮放縮放,我應該如何決定縮放因子的值,因爲當縮放因子值超過0 [即負值]圖像是gettig傾斜的,我不希望它發生。如何避免這種情況。在CGAffineTransformMakeScale中的zoomfactor值iPhone
2)Y是閃爍的旋轉發生的類型,Y不是平滑的旋轉?這是由 CGAffineTransformMakeScale(zoomfactor,zoomfactor);
方法嗎?
這是我在我的代碼正在做: zoomFactor = 0; //開始zoomfactor設置爲零
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
NSLog(@" Inside touchesBegan ..................");
NSArray *twoTouches = [touches allObjects];
UITouch *first = [twoTouches objectAtIndex:0];
OPERATION = [self identifyOperation:touches :first];
NSLog(@"OPERATION : %d",OPERATION);
if(OPERATION == OPERATION_PINCH){
//double touch pinch
UITouch *second = [twoTouches objectAtIndex:1];
f_G_initialDistance = distanceBetweenPoints([first locationInView:self.view],[second locationInView:self.view]);
}
NSLog(@" leaving touchesBegan ..................");
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@" Inside touchesMoved .................");
NSArray *twoTouchPoints = [touches allObjects];
if(OPERATION == OPERATION_PINCH){
CGFloat currentDistance = distanceBetweenPoints([[twoTouchPoints objectAtIndex:0] locationInView:self.view],[[twoTouchPoints objectAtIndex:1] locationInView:self.view]);
int pinchOperation = [self identifyPinchOperation:f_G_initialDistance :currentDistance];
G_zoomFactor = [self calculateZoomFactor:pinchOperation :G_zoomFactor];
[uiImageView_G_obj setTransform:CGAffineTransformMakeScale(G_zoomFactor, G_zoomFactor)];
[self.view bringSubviewToFront:resetButton];
[self.view bringSubviewToFront:uiSlider_G_obj];
f_G_initialDistance = currentDistance;
}
NSLog(@" leaving touchesMoved ..................");
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@" Inside touchesEnded ..................");
NSArray *twoTouches = [touches allObjects];
UITouch *first = [twoTouches objectAtIndex:0];
if(OPERATION == OPERATION_PINCH){
//do nothing
}
NSLog(@" Leaving touchesEnded ..................");
}
謝謝。