is there possible way call delegates , datasource inside grand central dispatch main_queue?
please help. if these delegates , datasource aren't called, images not displayed!
here code:
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; } }); });
you cannot directly call delegate / datasource method, can call supporting methods trigger delegate or data source methods. eg. table view - if call reload table view, data source , delegate methods associated reload table called.
but in case of gcd, if respective class's object in scope, reflect change. or else of no use.
please provide details of exact scenario / code can guid more accurately.
Comments
Post a Comment