ios - No visible interface for UITabBarItem when trying to set selectedImage -


i've seen can add selectedimage image uitabbaritem, amended cordova plugin add that:

uiimage *tabicon = [uiimage imagenamed:imagename]; uiimage *selectedtabicon = [uiimage imagenamed:selectedimage]; tabicon = [tabicon imagewithrenderingmode:uiimagerenderingmodealwaysoriginal]; selectedtabicon = [selectedtabicon imagewithrenderingmode:uiimagerenderingmodealwaysoriginal]; item = [[uitabbaritem alloc] initwithtitle:title image:tabicon tag:tag selectedimage:selectedtabicon]; 

with selectedimage variable being string passed in plugin here:

  nsstring  *name      = [arguments objectatindex:0];   nsstring  *title     = [arguments objectatindex:1];   nsstring  *imagename = [arguments objectatindex:2];   nsstring *selectedimage = [arguments objectatindex:3];   int tag              = [[arguments objectatindex:3] intvalue]; 

however when try compile following error:

/users/tomchambers/work/cordova-ios-tab-bar/src/ios/cdvtabbar.m:266:34: error: no visible @interface 'uitabbaritem' declares selector 'initwithtitle:image:tag:selectedimage:' item = [[uitabbaritem alloc] initwithtitle:title image:tabicon tag:tag selectedimage:sel... ~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated.

** build failed ** 

i not experienced objective c, think might simple i'm missing here.


when using different method (images exist):

  uitabbaritem *item = [[uitabbaritem alloc] initwithtitle:@"random" image:[uiimage imagenamed:@"www/assets/images/tab-bar-icons/ic_mail_outline.png"] selectedimage:[uiimage imagenamed:@"www/assets/images/tab-bar-icons/ic_mail_outline.png"]]; 

2016-02-08 11:48:31.367 movidiam[1847:843403] apache cordova native platform version 3.9.2 starting. 2016-02-08 11:48:31.369 movidiam[1847:843403] multi-tasking -> device: yes, app: yes 2016-02-08 11:48:31.372 movidiam[1847:843403] unlimited access network resources 2016-02-08 11:48:31.679 movidiam[1847:843403] [cdvtimer][statusbar] 152.289033ms 2016-02-08 11:48:31.680 movidiam[1847:843403] [cdvtimer][totalpluginstartup] 152.797997ms 2016-02-08 11:48:31.847 movidiam[1847:843403] resetting plugins due page load. 2016-02-08 11:48:34.294 movidiam[1847:843403] -[__nsdictionarym intvalue]: unrecognized selector sent instance 0x13f82d430 2016-02-08 11:48:34.295 movidiam[1847:843403] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[__nsdictionarym intvalue]: unrecognized selector sent instance 0x13f82d430' *** first throw call stack: (0x1834f9900 0x182b67f80 0x18350061c 0x1834fd5b8 0x18340168c 0x1000eaf4c 0x100102528 0x100101df4 0x183ebbe20 0x1834b0efc 0x1834b0990 0x1834ae690 0x1833dd680 0x1848ec088 0x188254d90 0x1000c7814 0x182f7e8b8) libc++abi.dylib: terminating uncaught exception of type nsexception (lldb)  

the method have used instantiate tabbaritem doesn't exist. must use 1 of them:

uitabbaritem * item = [[uitabbaritem alloc] initwithtitle:@"title" image:[uiimage imagenamed:@"image.png"] tag:1]; 

or

uitabbaritem *item1 = [[uitabbaritem alloc] initwithtitle:@"title" image:[uiimage imagenamed:@"image.png"] selectedimage:[uiimage imagenamed:@"selectedimage.png"]];  

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -