The rootViewController is not a NavigationController.
[quote=151986:@Hironobu Sekine] Dim newView As iOSView
select case row
case 0
newView = New ViewBackgroundColor
case 1
newView = new SetNavigationBarColor
end select
Self.PushTo(newView)[/quote]
It was there but for some reason disappeared. Could be a bug. I have added it again and updated the repository.
Thank you.
Jason, try replacing.
declare function navigationController lib UILib selector "navigationController" (viewController as ptr) as ptr
dim navigationControllerRef as ptr = navigationController(self.ViewControllerHandle) //self is the iOSView
declare function navigationBar lib UILib selector "navigationBar" (obj_id as ptr) as ptr
dim navigationBarRef as ptr = navigationBar(navigationControllerRef)
No it doesn’t seem to work.
This works in a tabbed view. Thank you @ Richard Berglund :
[code]Sub Action()
declare function NSClassFromString lib “Foundation” (classname as CFStringRef) as ptr
declare function keyWindow lib “UIKit” selector “keyWindow” (obj_ref as ptr) as ptr
declare function sharedApplication lib “UIKit” selector “sharedApplication” (obj_ref as ptr) as ptr
declare function rootViewController lib “UIKit” selector “rootViewController” (obj_ref as ptr) as ptr
declare function navigationBar lib “UIKit” selector “navigationBar” (obj_ref as ptr) as ptr
declare function navigationController lib “UIKit” selector “navigationController” (viewController as ptr) as ptr
dim navigationControllerRef as ptr = navigationController(self.ViewControllerHandle) //self is the iOSView
dim navigationBarRef as ptr = navigationBar(navigationControllerRef)
dim sApp as ptr=sharedApplication(NSClassFromString(“UIApplication”))
dim currentWindow as ptr=keyWindow(sApp)
dim navController as ptr=rootViewController(currentWindow)
dim navBar as ptr= navigationBar(navigationControllerRef)
Declare Sub setBarTintColor lib UIKit selector “setBarTintColor:” (id as ptr, UIColor as Ptr)
setBarTintColor navBar, UIColor(&cFF0000)
declare Sub setTintColor lib UIKit selector “setTintColor:” (id as ptr, UIColor as Ptr)
setTintColor navBar, UIColor(&cFF7700)
declare sub setTranslucent lib UIKit selector “setTranslucent:” (id as ptr)
setTranslucent navBar
End Sub
[/code]
I have updated the wrapper with this code as well.
It works in the View_Activate event (I tried it in View_Open and that doesn’t work). Thanks Michel!
Don’t forget that console.app often has very meaningful messages in the crash logs. Very often, what seems like a hard crash will show an error.
For example:
Application Specific Information:
*** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[UIButton setBackgroundImage:forState]: unrecognized selector sent to instance 0xc03b750’
Showed up because the selector should have been “setBackgroundImage:forState:”
Console logs generally make these things MUCH easier to pinpoint.
Thanks Jim. I’ll have to get into the habit of looking at the Console log.
Console has it’s own permanent spot in my Dock.