如何在 imageview 中添加图像数组
-(IBAction)btnNextTapped
{
self.currentPhotoIndex++;
if([allPhotosArray count]>0) {
if(self.currentPhotoIndex>=[allPhotosArray count]) {
self.currentPhotoIndex=0;
}
NSLog(@"====== allphotos in this county :%d",[allPhotosArray count]);
mugImage.image = [UIImage imageWithData: [NSData dataWithContentsOfURL: [NSURL URLWithString: [allPhotosDict objectForKey:@"Photo"]]]];
}
}
当我单击下一个按钮时,将调用此方法,但是当我单击下一个按钮时,图像应该更改,但这里我没有获取下一个图像, 请帮助我
预先感谢您
-(IBAction)btnNextTapped
{
self.currentPhotoIndex++;
if([allPhotosArray count]>0) {
if(self.currentPhotoIndex>=[allPhotosArray count]) {
self.currentPhotoIndex=0;
}
NSLog(@"====== allphotos in this county :%d",[allPhotosArray count]);
mugImage.image = [UIImage imageWithData: [NSData dataWithContentsOfURL: [NSURL URLWithString: [allPhotosDict objectForKey:@"Photo"]]]];
}
}
when i clicked next button , this method would be called, but when ever iam clickin on the next button the image should be change, but here iam not getting next image ,
Plese help me
Thank you in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为你必须编写以下代码才能更改图像。
I think you have to write following code in order to change images.
您将所有图像放入一个数组中。因此,请设置一个变量来计算您的点击次数。每当您单击按钮时,只需将 var 的计数增加一并将该数组索引图像设置到您的 imageview 中......
You have all images into an array. So set one var that counts your click. Whenever you click on your button, just increase count of var by one and set that array index image into your imageview ....