我是iOS开发的新手。我想在我的应用程序中做一个应用程序,我做一个UIScrollview和在这个UIScrollView我添加一个UIImageview。当viewDidAppear我喜欢设置为如何通过iOS中的UISwipeGestureRecognizer在ImageView中通过SwipeLeft在ImageView中显示NextImage?
-(void)viewDidAppear:(BOOL)animated
{
NSDictionary *dict=[self.imagesa objectAtIndex:0];
NSString *imagelink=[dict valueForKey:@"link"];
NSLog(@"imageLink %@",imagelink);
[self.bigImage sd_setImageWithURL:[NSURL URLWithString:imagelink] placeholderImage:[UIImage imageNamed:@"1.png"]];
}
和代码添加一个手势我的ImageView和Scrollvie等作为
UISwipeGestureRecognizer *swipeGestureLeftdirection=[[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(slideToLeftWithGestureRecognizer:)];
swipeGestureLeftdirection.delegate=self;
swipeGestureLeftdirection.direction=UISwipeGestureRecognizerDirectionLeft;
[self.bigImage addGestureRecognizer:swipeGestureLeftdirection];
[self.bigScrollview addGestureRecognizer:swipeGestureLeftdirection];
UISwipeGestureRecognizer *swipeGestureRightdirection=[[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(slideToRighttWithGestureRecognizer:)];
swipeGestureRightdirection.delegate=self;
swipeGestureRightdirection.direction=UISwipeGestureRecognizerDirectionRight;
[self.bigImage addGestureRecognizer:swipeGestureRightdirection];
[self.bigScrollview addGestureRecognizer:swipeGestureRightdirection];
这里Self.bigimage是我的UIImageView和self.bigScrollview是我的UIScrollView ImageView的图像。 现在我想当用户向左滑动,然后我想UIImageview图像self.imagesa下一个索引和刷卡权然后我想UIImageVIew图像回索引图像如何可能。请给我解决方案。
显示您UISwipeGestureRecognizer行动 – Sport 2014-11-24 06:31:39
@Sport UISwipeGestureRecognizer动作 - (void)slideToLeftWithGestureRecognizer:(UISwipeGestureRecognizer *)gestureReco gnizer {index = 0; index <[self.imagesa count]; index ++) { self.bigImage.image = [self.imagesa objectAtIndex:index + 1]; } } – 2014-11-24 06:35:26