更新類A的UI元素(UIViewController)我試圖從B類即View-Controller
和View類型類更改類A的背景顏色,但我不是能夠做到這一點。如何從另一個類B即(UIVIew)
我知道有一件事我必須做與線程。 我曾嘗試使用performSelectorOnMainThread
方法和更多,但沒有爲我工作。
我的代碼給出如下─
// In Class B
-(void)method{
ClassAViewController *AView=[[ClassAViewController alloc]init];
AView.imageIndex=self.currentRenderingImageIndex;
[AView findIndexOfImage];
}
現在我調用類方法
-(void)findIndexOfImage
{
NSLog(@"print the index is %i",imageIndex);// This is working fine
AView.backgroundColor=[UIColor blueColor];// Here it is not updating my view.
}
我知道這是很無聊的問題,我問在這裏,請告訴我,我應該怎麼辦。
use self.backgroundColor = [UIColor blueColor]; –