ios - Editing argument in objective-c blocks -


i want edit uiimage pointer in block it's not allowed.

-(void)downloadimage:(nsurl *)url ofpointer:(uiimage *)imagepointer {     __weak typeof(self) weakself = self;     [sdwebimagemanager.sharedmanager downloadwithurl:url                                              options:0                                             progress:^(nsuinteger receivedsize, long long expectedsize) {}                                            completed:^(uiimage *image, nserror *error, sdimagecachetype cachetype, bool finished) {                                                imagepointer = image;                                                [weakself setneedsdisplay];                                            }]; 

}

i tried pass argument __block it's not allowed too.

-(void)downloadimage:(nsurl *)url ofpointer:(__block uiimage *)imagepointer

is there way edit pointer passed argument?

you need use pointer pointer (uiimage **) image immutable object if change inside block wouldn't have effect desire.

what should use delegation or callback block pass downloaded image out of block instance going use it.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

keyboard - C++ GetAsyncKeyState alternative -

android - java.net.UnknownHostException(Unable to resolve host “URL”: No address associated with hostname) -