开发者

Swipe in Landscape view using uigestureswipe

开发者 https://www.devze.com 2023-03-17 02:07 出处:网络
Can we implement UISwipeGesture in the landscape开发者_如何学运维 view of images?Use the following:

Can we implement UISwipeGesture in the landscape开发者_如何学运维 view of images?


Use the following:

In your view did load (to add gesture recognizer to your view):

UISwipeGestureRecognizer *rightRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(rightSwipeHandle:)];
rightRecognizer.direction = UISwipeGestureRecognizerDirectionRight;
[rightRecognizer setNumberOfTouchesRequired:1];
[mainSlideShowImageScrollView addGestureRecognizer:rightRecognizer];
[rightRecognizer release];
UISwipeGestureRecognizer *leftRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(leftSwipeHandle:)];
leftRecognizer.direction = UISwipeGestureRecognizerDirectionLeft;
[leftRecognizer setNumberOfTouchesRequired:1];
[mainSlideShowImageScrollView addGestureRecognizer:leftRecognizer];
[leftRecognizer release];   

Then implement the following method:

- (void)rightSwipeHandle:(UISwipeGestureRecognizer*)gestureRecognizer 
   {
      //Do moving
   }

- (void)leftSwipeHandle:(UISwipeGestureRecognizer*)gestureRecognizer 
{
  // do moving
}
0

精彩评论

暂无评论...
验证码 换一张
取 消