Can I set image as a title to UINavigationBar?

后端 未结 16 1913
有刺的猬
有刺的猬 2020-12-07 09:38

Is it possible to set some image as title of Navigation bar?

I think NYTimes application used a Navigation bar and title is look like image file (the reason why it\'

16条回答
  •  星月不相逢
    2020-12-07 10:16

    The following is how you would do this in (Xamarin's) MonoTouch with C#.NET

    Create a UIViewConvrtoller that is in a NavigationController then call this at any time:

    someNiceViewControllerYouMade.NavigationController.NavigationBar
         .InsertSubview(new UIImageView
         (MediaProvider.GetImage(ImageGeneral.navBar_667x44)),0);
    

    Note: MediaProvider is just a class that fetches images.

    This example allows for the view to fill the full Navigation Bar , and lets the text for the items caption appear too.

提交回复
热议问题