iOS Question Navigation bar set

Discussion in 'iOS Questions' started by fishwolf, Nov 22, 2014.

  1. fishwolf

    fishwolf Active Member Licensed User

    Thre questions on top navigation bar:

    1) is it possible change color to title text ?

    2) is it possible set font properties (bold for example, or dimension) ?

    3) If i use a image into navigation bar, a image white with transparent background (android icon),
    why the white color is show as blue ?

    Thanks
    ic_action_action_help.png
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    1, 2) Yes. You can use this code to change the title style:
    Code:
    Private Sub Application_Start (nav As NavigationController)
       SetNavigationBarTitleStyle(
    Colors.Red, Font.CreateNewBold(20))
       
    Dim nav As NavigationController
       nav.Initialize(
    "nav")
       App.KeyController = nav
       NavControl = nav
       Page1.Initialize(
    "Page1")
       NavControl.ShowPage(Page1)
       Page1.RootPanel.LoadLayout(
    "1")
    End Sub

    Sub SetNavigationBarTitleStyle(Color As Int, Fnt As Font)
       
    Dim attributes As NativeObject
       
    attributes = CreateMap("NSFont": Fnt, "NSColor"attributes.ColorToUIColor(Color))
       
    Dim no As NativeObject
       no.Initialize(
    "UINavigationBar").RunMethod("appearance"Null) _
         .RunMethod(
    "setTitleTextAttributes:"Array(attributes.RunMethod("ToDictionary"Null)))
    End Sub
    Note that you need to create a new NavigationController and set it as the KeyController (see the code above).

    3) The image will show as a single color image based on the non-transparent pixels.
     
  3. fishwolf

    fishwolf Active Member Licensed User

    Thanks,

    1-2) OK

    point 3) i don't understand if is possibile have white icon ?
    now icon and the result are as attachment.
     

    Attached Files:

  4. Erel

    Erel Administrator Staff Member Licensed User

    Change the button TintColor property to change its color.
     
  5. fishwolf

    fishwolf Active Member Licensed User

    thanks, i haven't see the properties

    is it change also the color to the back navigation button ?

    i have notice that the hide of back into designer doesn't work.

     
  6. Erel

    Erel Administrator Staff Member Licensed User

    It does work. I just tested it.
    Make sure that you set the property to the current page (the top most page).

    You can set the navigation bar tintColor property to change the color of all the bar buttons:
    Code:
    Sub SetNavigationBarTintColor(clr As Int)
       
    Dim no As NativeObject = NavControl
       no.GetField(
    "navigationBar").SetField("tintColor", no.ColorToUIColor(clr))
    End Sub
     
    Mike1970 likes this.
  7. fishwolf

    fishwolf Active Member Licensed User

    I would change font and size to text of prompt, i'm try to replace

    setTitleTextAttributes with setPromptTextAttributes, but doen't work.

    other to show me the final solution, can you show me how to find native parameters?

    i hope the next version will have these parameters in basic or design mode :)
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    The prompt text will use the same style as the title.
     
  9. tcgoh

    tcgoh Active Member Licensed User

    Is its possible to set the toprightbutton text on runtime

    page1.TopRightButtons.Add("KKK")
    or
    page1.TopRightButtons.Add(edittext1.text)
     
  10. Erel

    Erel Administrator Staff Member Licensed User

    Yes. But you should start a new thread for this question.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice