ios - Image not showing up in UITabBarItem -


i using uitabbar , uitabbaritem. have url of image. set uitabbaritem's image image using url. image not showing up. if use other image macbook, works. url correct, verified copy pasting in browser. below code. can see problem?

uiimage * iconimage = [uiimage imagewithdata:[nsdata datawithcontentsofurl:[nsurl urlwithstring:singlematch.imageurl]]]; // add uitabbaritem array [tabs addobject:[[uitabbaritem alloc] initwithtitle:singlematch.realname image:[self convertimage:iconimage tosize:cgsizemake(40, 30)] tag:i]]; [self.chattabbar setitems:tabs animated:yes]; 

i use below method resize image fit in uitabbaritem // resizes given image specified cgsize

- (uiimage *)convertimage:(uiimage *)image tosize:(cgsize)size {     uigraphicsbeginimagecontextwithoptions(size, no, 0.0);     [image drawinrect:cgrectmake(0, 0, size.width, size.height)];     uiimage * resizedimage = uigraphicsgetimagefromcurrentimagecontext();     uigraphicsendimagecontext();     return resizedimage; } 

i solved problem using method.
- (void)setfinishedselectedimage:(uiimage *)selectedimage withfinishedunselectedimage:(uiimage *)unselectedimage
here, selectedimage shown when uitabbaritem selected , inselectedimage shown when not selected.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -