0

我想通过使用 uiimage 视图更改下一个按钮单击时的图像。我正在使用以下链接获取图像。

http://01s.in/webservices/ratemypic/getData.php?db_table=image

谢谢大家

4

3 回答 3

0
//Are you getting the image or not ...   
//if yes then  just make the button action method let say...... 

changeImage:(id)sender{
  UIButton *btn = (UIButton*)sender
  [btn setImage:yourUIImage forControlState:UIControleStateNormal];
}
于 2012-06-13T09:57:22.080 回答
0

当您想更改按钮图像时,只需使用波纹管...

[yourButton setImage:[UIImage imageWithName:@"yourImageName"] forControlState:UIControleStateNormal];
于 2012-06-13T10:01:11.690 回答
0

首先使用解析这个字符串

NSArray *tempArry = [firstArryStr componentsSeparatedByString@".png"];

现在 tempArray 将包含图像名称。在按钮操作中,您可以使用 index(它是静态 var)来迭代此数组并在 imageview 中显示图像,如下所示:

UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"%@.png"],[tempArray objectAtIndex:index]];
index++;

并检查 index == [tempArray length] 是否,然后将其重置为 0。在 UIImageView 中使用此图像。

于 2012-06-13T10:01:39.830 回答