Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8518279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:56:13+00:00 2026-06-11T05:56:13+00:00

I tried to insert a custom button in the center of UINavigationBar (in titleView).

  • 0

I tried to insert a custom button in the center of UINavigationBar (in titleView). This still works in the first Level, but when I select in this TableView one cell and be pushed to the next controller, I’m not able to insert this button on the second controller too. The Right- and the LeftBarButtonItem are shown, but not the titleView.

When I’m working with the default settings and use viewController.title, it is shown in the titleView of this navigationBar, but my custom view is not shown.

My code in both controllers is

UIButton *centerNavigationButton = [UIButton buttonWithType:UIButtonTypeCustom];
[centerNavigationButton setBackgroundImage:[UIImage imageNamed: @"buttonImage.png"] forState:UIControlStateNormal];

centerNavigationButton.frame = (CGRect) {
  .size.width = 100,
  .size.height = 20,
};
[centerNavigationButton addTarget:self action:@selector(scrollToTop) forControlEvents:UIControlEventTouchUpInside];
[self.navigationController.navigationBar.topItem setTitleView:centerNavigationButton];

I searched for that since more than one day, but nowhere I found that issue for the second level.

Thanks for your help.


Edit:

The solution is found by @Martin R
in the first TableViewController i have to write

UIButton *centerNavigationButton = [UIButton buttonWithType:UIButtonTypeCustom];
[centerNavigationButton setBackgroundImage:[UIImage imageNamed: @"buttonImage.png"] forState:UIControlStateNormal];

centerNavigationButton.frame = (CGRect) {
  .size.width = 100,
  .size.height = 20,
};
[centerNavigationButton addTarget:self action:@selector(scrollToTop) forControlEvents:UIControlEventTouchUpInside];
[self.navigationController.navigationBar.topItem setTitleView:centerNavigationButton];

In the second level:

UIButton *centerNavigationButton = [UIButton buttonWithType:UIButtonTypeCustom];
[centerNavigationButton setBackgroundImage:[UIImage imageNamed: @"buttonImage.png"] forState:UIControlStateNormal];

centerNavigationButton.frame = (CGRect) {
  .size.width = 100,
  .size.height = 20,
};
[centerNavigationButton addTarget:self action:@selector(scrollToTop) forControlEvents:UIControlEventTouchUpInside];
[self.navigationItem setTitleView:centerNavigationButton];

Question can be closed.

Thanks a lot! 25 minutes from writing the question to found a solution! Great time!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T05:56:15+00:00Added an answer on June 11, 2026 at 5:56 am

    I think you have to set the titleView of the view controller’s navigationItem:

    self.navigationItem.titleView = centerNavigationButton;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried this url to insert uitextfield in custom cell but what i
I have mapped classes with custom sql (insert, delete, update) through procedure calls. But,
hello I built this tableview using the InterfaceBuilder and storyboard I used custom for
I created MVC ASP.Net Web application and tried insert Thai language data to SQL
I tried to insert a set of rows as soon as a table is
In my application I created a database and I tried to insert values into
I'm going crazy today. I just tried to insert a new record and it
I need to get the story_id from the last insert. Ive tried using mysql_insert_id()
I tried to create a single insert query for the values in template_list array.
How to insert html code inside an array in PHP? I tried searching on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.