我不使用UIGestureRecognizers用於自來水,捏和旋轉;知道如何處理這個問題: -/如何在多UIViews或UIImageViews的
我只需要在圖像上添加標籤。應用程序將confeins貼紙喜歡錶情符號,心(圖像)選擇特定的貼紙它將被添加到主圖像和用戶可以操縱與貼紙,像他旋轉,縮放等,用戶可以選擇多個貼紙,並可以做旋轉縮放等添加貼紙,
請指導如何實現這一點,我能夠執行圖像maniuplation與單貼紙我不怎麼執行它的多個貼紙選擇,用戶可以再次回到任何貼紙,並執行操作。
我不使用UIGestureRecognizers用於自來水,捏和旋轉;知道如何處理這個問題: -/如何在多UIViews或UIImageViews的
我只需要在圖像上添加標籤。應用程序將confeins貼紙喜歡錶情符號,心(圖像)選擇特定的貼紙它將被添加到主圖像和用戶可以操縱與貼紙,像他旋轉,縮放等,用戶可以選擇多個貼紙,並可以做旋轉縮放等添加貼紙,
請指導如何實現這一點,我能夠執行圖像maniuplation與單貼紙我不怎麼執行它的多個貼紙選擇,用戶可以再次回到任何貼紙,並執行操作。
您可以添加使用此方法的手勢:
- (void) addGestureRecognizers{
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(move:)];
[panRecognizer setMinimumNumberOfTouches:1];
[panRecognizer setMaximumNumberOfTouches:1];
[self addGestureRecognizer:panRecognizer];
UIRotationGestureRecognizer *rotateRecognizer = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(rotate:)];
self.multipleTouchEnabled = YES;
[self addGestureRecognizer:rotateRecognizer];
UIPinchGestureRecognizer *pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinch:)];
[self addGestureRecognizer:pinchRecognizer];
UILongPressGestureRecognizer *longPressRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressed:)];
longPressRecognizer.minimumPressDuration = 2.0;
[self addGestureRecognizer:longPressRecognizer];
}
和執行這些選擇:
- (void) move:(UIPanGestureRecognizer *)recognizer{
CGPoint translation = [recognizer translationInView:self.superview];
recognizer.view.center = CGPointMake(recognizer.view.center.x+translation.x, recognizer.view.center.y+translation.y);
[recognizer setTranslation:CGPointMake(0, 0) inView:self.superview];
}
- (void) rotate:(UIRotationGestureRecognizer *)recognizer{
NSLog(@"Rotate");
recognizer.view.transform = CGAffineTransformRotate(
recognizer.view.transform,
recognizer.rotation);
recognizer.rotation = 0;
}
- (void) pinch:(UIPinchGestureRecognizer *)recognizer{
recognizer.view.transform = CGAffineTransformScale(recognizer.view.transform, recognizer.scale, recognizer.scale);
recognizer.scale = 1;
}
- (void) longPressed:(UILongPressGestureRecognizer *)recognizer{
NSLog(@"Long Pressed");
}
注意:只要你想
我期待當你particuler圖像單擊要執行對particuler肖像權有所行動,然後再嘗試這樣可能it'l幫助你
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageTapped:)];
要添加手勢圖像視圖
...
- (void)imageTapped:(UITapGestureRecognizer *)sender
{
UIView *selectedView = sender.view;
//perform action here
or
sender.view.frame=newFrame;//you can set your frame
}
添加這一個用於同時手勢識別。
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{
return YES:
}
你的意思是更改值說你旋轉一個貼紙,並且所有貼紙旋轉。 – Bonnie 2013-05-13 12:58:26
沒有用戶會通過點擊選擇一個貼紙,只有該貼紙會旋轉,縮放或移動 – Gaurav 2013-05-13 13:00:56