[英]NSFetchedResultsControllerDelegate delegates methods are not called
[英]Delegates and Datasource methods not called
是否可以在Grand Central Dispatch main_queue中調用委托和數據源?
請幫忙。 如果未調用這些委托和數據源,則不會顯示我的圖像!
這是代碼:
messageWebService = [[MessageWebServices alloc]init];
tempBO = [[MessageBO alloc]init];
tempBO.messageId = self.messageID;
dispatch_async(webServiceBackGroundQueue, ^(void){
tempBO = [messageWebService getDetails:tempBO];
dispatch_async(dispatch_get_main_queue(), ^
{
if (!tempBO.isException)
{
self.subjects.text = tempBO.subject;
self.content.text = tempBO.messageli;
self.userNmae.text = tempBO.userNmae;
self.creaDAte.text = tempBO.creationDate;
self.phoneNumb.text = tempBO.phoneNumber;
self.eMail.text = tempBO.email;
self.amount.text = [NSString stringWithFormat:@"$ %@",tempBO.priceAmount];
self.imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:tempBO.imageURL]];
self.img = [UIImage imageWithData:self.imageData];
if(self.img)
{
[imageArray addObject:self.img];
}
else
{
[imageArray addObject:[UIImage imageNamed:@"no_photo.png"]];
}
hFlowView.delegate = self;
hFlowView.dataSource = self;
hFlowView.pageControl = hPageControl;
}
});
});
您不能直接調用委托/數據源方法,但是可以調用將觸發委托或數據源方法的支持方法。 例如。 對於表視圖-如果調用重載表視圖,則將調用與重載表關聯的數據源和委托方法。
但是對於GCD,只有相應類的對象在范圍內,它們才會反映出更改。 否則就沒有用了。
請提供您的確切方案/代碼的更多詳細信息,以便我們更准確地指導您。
您可以將任何代碼放入gcd塊中。 但是,請注意,執行該塊時,對象,委托對象和數據源對象仍在范圍內。 您可能需要移動局部變量(例如)作為成員變量。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.