Marshalling iOS Navigation Bar attributes

Thread is closed for posting
3 posts, 1 answers
  1. Brett
    Brett avatar
    23 posts
    Member since:
    Feb 2006

    Posted 24 Mar 2015 Link to this post

    I've read the marshalling page but stil can't figure this out. What is the Javascript equivalent of this:
    [[UINavigationBar appearance]setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor blackColor]} forState:UIControlStateNormal]; 

    I have a reference to the navbar using this code below so I'm wondering if it can be used to set the attributes:
    var controller = frameModule.topmost().ios.controller;
    controller.navigationBar.barTintColor = navbarColor; 
  2. Answer
    Jason Zhekov
    Admin
    Jason Zhekov avatar
    3 posts

    Posted 24 Mar 2015 Link to this post

    Hello,

    The rough equivalent of what you want is this:

    var attributes = new NSMutableDictionary();
    attributes.setObjectForKey(UIColor.blueColor(), UITextAttributeTextColor);
    controller.navigationBar.titleTextAttributes = attributes;

    This will set the text color of the navigation bar title to blue. You can find out how to change the other attributes it in the apple docs.

    Regards,
    Jason Zhekov
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. Brett
    Brett avatar
    23 posts
    Member since:
    Feb 2006

    Posted 24 Mar 2015 in reply to Jason Zhekov Link to this post

    Perfect, thanks.
Back to Top