I use XojoiOSWrapper for colorize a navigationBar. But when I tested the wrapper project with real device (Iphone 6+ iOS 9), the navigation bar is colorized to dark grey.
This is the code :
[code] 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
dim sApp as ptr=sharedApplication(NSClassFromString(“UIApplication”))
dim currentWindow as ptr=keyWindow(sApp)
dim navController as ptr=rootViewController(currentWindow)
dim navBar as ptr= navigationBar(navController)
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
[/code]
I think the issue is the UIColor method with iOS 9. It needs to be adapted.
But it worked with iOS 8.
Now I want to set title text of navigation bar to white.
This code not works :
declare sub setTitleTextAttributes lib UIKit selector "setTitleTextAttributes:" (id as ptr, UIColor as Ptr)
setTitleTextAttributes navBar,new UIColor(&cFFFFFF)
const NSForegroundColorAttributeName = "NSColor"
dim dictionaryRef as ptr = NSClassFromString("NSDictionary")
declare function dictionaryWithObjectForKey lib Foundationlib selector "dictionaryWithObject:forKey:" (dictRef as ptr, obj as ptr, key as cfstringref) as ptr
dim titleDict as ptr = dictionaryWithObjectForKey(dictionaryRef,new UIColor(&cFFFFFF),NSForegroundColorAttributeName)
declare sub setTitleTextAttributes lib UIKit selector "setTitleTextAttributes:" (id as ptr, attribute as ptr) setTitleTextAttributes(navigationBarRef,titleDict)
Michel,
En franais, pour ma part j’ai utilis la methode UIColor de IOSKit de Jason king que j’ai mis la place dans IOSWrapper. Puis utilis le code de Jason, pour colorer ma navigation bar. Tout est ok.
Replace UIColor method on XojoIOSWrapper by UIColor method in IOSKit by Jason King.
[quote=224421:@JrmeLeray]Michel,
En franais, pour ma part j’ai utilis la methode UIColor de IOSKit de Jason king que j’ai mis la place dans IOSWrapper. Puis utilis le code de Jason, pour colorer ma navigation bar. Tout est ok.
Replace UIColor method on XojoIOSWrapper by UIColor method in IOSKit by Jason King.[/quote]