1

I have something like this:

titleBar_image

But I need that the view that am setting for the titleView, doesn't has those margins on the left and right side. Something like this:

titleBar_image2

This is what am actually doing:

@property (nonatomic, strong) XHScrollMenu *scrollMenu; // where XHScrollMenu is a subclass of UIView

- (void)viewdidLoad{
 _scrollMenu = [[XHScrollMenu alloc] initWithFrame:self.navigationController.navigationBar.frame];
 _scrollMenu.backgroundColor = [UIColor clearColor];
 _scrollMenu.delegate = self;
 _scrollMenu.selectedIndex = 0;
 self.navigationItem.titleView =self.scrollMenu;
}

I tried giving the view a with of 320, but I got the same result. I read in other post, that maybe a subclass make the trick, but don't know how to implement that solution...

How can I make the title view use the entire width?

FelipeDev.-
  • 2,863
  • 3
  • 19
  • 32
  • It might help if anything even called the method you posted. – nhgrif May 01 '14 at 03:45
  • I think you may find the solution in this thread: https://stackoverflow.com/questions/18914812/how-to-edit-empty-spaces-of-left-right-uibarbuttonitem-in-uinavigationbar-ios – PJ_Finnegan Oct 31 '17 at 15:39

1 Answers1

-1

Try with bounds instead of frame. see different between bounds and frame.

...initWithFrame:self.navigationController.navigationBar.bounds] /// or give frame manually such like CGRectMake(x,y,self.view.frame.size.width, yourHeight);

If this suggestion doesn't help you then sure problem under initWithFrame of XHScrollMenu. Go in this method and check there.

Community
  • 1
  • 1
iPatel
  • 41,165
  • 13
  • 109
  • 131