0
只是卡住了奇怪的事情。我有以下代码:performSelectorOnMainThread奇怪
-(void)ImageDownloadCompleat
{
[self performSelectorOnMainThread:@selector(updateImageButton:)
withObject:nil
waitUntilDone:YES];
}
-(void)updateImageButton {
NSLog(@"image OKEY");
UIImage *img = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:
@"%@/%@.jpg",pathPreview,self.idProducts]];
//images.image = img;
[images setBackgroundImage:img forState:UIControlEventTouchUpInside];
[img release];
}
它崩溃,发生了无法识别的选择器发送实例错误。上面的代码有什么问题?
预先感谢
感谢它做了伎俩..但按钮的背景图像仍然没有更新,虽然图像被创建,真的存在于文件系统中...什么是做错了? – Adviser2010 2011-05-19 09:48:04
@ Adviser2010:您正在为UIControlEventTouchUpInside设置背景图像,即在按钮内释放触摸时。那是你想要的吗?你可以做一个快速的NSLog(@“%@”,img)来确认这个东西已经加载,而且你也不应该因为没有拥有引用而释放它。 – Tommy 2011-05-19 11:30:30
不,我想到我使用了错误的UIControlEvent ...在应用了正确的一个之后 - 它的功能就像魅力 – Adviser2010 2011-05-31 05:04:53