I have been trying to get Jason’s code from a post about 5 months ago working but when I call the method it keeps rejecting the myViewName.
How do I reference the name
sub setNavBarColor(v as iOSView, barColor as color, buttonColor as color, translucent as boolean = false)
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(v.ViewControllerHandle)
dim sApp as ptr = sharedApplication(NSClassFromString(“UIApplication”))
dim navBar as ptr = navigationBar(navigationControllerRef)
declare sub setTintColor lib UIKitLib selector “setTintColor:” (id as ptr, UIColor as Ptr)
setTintColor navBar, new UIColor(buttonColor)
declare sub setBarTintColor lib UIKitLib selector “setBarTintColor:” (id as ptr, UIColor as Ptr)
setBarTintColor navBar, new UIColor(barColor)
if translucent then
declare sub setTranslucent lib UIKitLib selector “setTranslucent:” (id as ptr)
setTranslucent navBar
end
end sub
Call it like this:
SetNavBarColor myViewName, myBarColor, myButtonColor