在ios中自动滚动图像

在ios中自动滚动图像,ios,Ios,我在数组中有多个图像和一个滚动视图,所有图像都应该自动滚动,当我单击图像时,它应该导航到其他视图并显示其详细信息。完成图像从0滚动到数组末尾后,应再次加载第一个图像,即0。在动画方面我有很多问题,请帮助我 我正在使用这个代码 [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(onTimer) userInfo:nil repeats:YES]; - (void) onTimer {

我在数组中有多个图像和一个滚动视图,所有图像都应该自动滚动,当我单击图像时,它应该导航到其他视图并显示其详细信息。完成图像从0滚动到数组末尾后,应再次加载第一个图像,即0。在动画方面我有很多问题,请帮助我

我正在使用这个代码

  [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(onTimer) userInfo:nil repeats:YES];

- (void) onTimer {

    // Updates the variable h, adding 100 (put your own value here!)
    h += 100; 

    //This makes the scrollView scroll to the desired position  
    yourScrollView.contentOffset = CGPointMake(0, h);  

}

尝试滚动图像,使用自动滚动示例作为参考,如果要重复循环中的内容,请将wrap属性设置为yes。将图像数组添加到旋转木马,并实现旋转木马数据源和委托方法来滚动图像。您可以更改不同的类型,如线性、旋转或溢流等。

之后您可以创建图像输出

NSMutableArray *imgArray = [[NSMutableArray alloc]init];
    for (int i =0; i<imgUrlArray.count; i++) {
        NSString *imgStr = [serviceImgArray objectAtIndex:i];
        NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:imgStr]];
        [imgArray addObject:[UIImage imageWithData:imageData]];
    }
    yourimageView.animationImages = imgArray;
    yourimageView.animationDuration = 10;
    [yourimageView startAnimating];
NSMutableArray*imgArray=[[NSMutableArray alloc]init];
对于(int i=0;它可以帮助您