1) Я делаю пинч-масштабирование в UIImageView, как я должен принять решение о значении zoomfactor, потому что когда значение zoomfactor превышает 0 [т.е. отрицательное значение], изображение становится наклоненным, чего я не хочу, чтобы это произошло , как избежать этой ситуации.
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 ..................");
}
Спасибо.