【发布时间】:2012-10-19 18:39:22
【问题描述】:
在我的应用程序中,我有一个上下文,我正在使用 NSTimer 更改 UIButton 的图像,如下所示
[NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(LoadImageToTheAdButton) userInfo:nil repeats:YES];
-(void)LoadImageToTheAdButton
{
NSString *strPath = [arrPaths objectAtIndex:0];
strPath = [strPath stringByAppendingPathComponent:@"Folder"];
strPath = [strPath stringByAppendingPathComponent:[arrAdImgNames objectAtIndex:intAdImgIndex]];
UIImage *imgForAdBtn = [[UIImage alloc]initWithContentsOfFile:strPath];
[btnAd setBackgroundImage:imgForAdBtn forState:UIControlStateNormal];
if(intAdImgIndex < [arrAdImgNames count]-1)
{
intAdImgIndex++;
}
else
{
intAdImgIndex = 0;
}
}
现在点击按钮 *我需要知道按钮上设置了哪个图像我的意思是,我需要图像名称 *
我需要它,因为我正在根据该图像加载一些链接,
请问哪位大侠能帮帮我,怎么办,
提前致谢
【问题讨论】:
-
您不能将名称保存在视图控制器的属性中(同时更新它们)吗?
标签: iphone objective-c ios xcode uibutton