2

I am using the titleView property of a UINavigationBar inside a UINavigationController. Is there any way to have the titleView's width be dynamically adjusted to fill the space in between the any buttons on the left and any buttons on the right? (Ideally without manual calculations)

roozbubu
  • 1,106
  • 4
  • 14
  • 30
  • Why don't you use the `UIViewController`'s `title` property ? In this way the title will be resized and will fill all the space available. – danypata Aug 12 '13 at 17:15
  • I have a custom view with 2 UILabels and 2 images – roozbubu Aug 12 '13 at 17:16
  • The thing is that iOS will create by default some space between the bar buttons and the title view, and since you can't get the width of the bar buttons, I don't think there is an easy solution for this. – danypata Aug 12 '13 at 17:19
  • Hmm, interesting. Any other solutions you might recommend? – roozbubu Aug 12 '13 at 17:24
  • Well I had this issue to but I didn't had enough time to search for a clean solution so I used brute force and try and error to find the max with that the titleView can have. – danypata Aug 12 '13 at 17:25
  • Well if you can't get the width of bar buttons, how exactly did you determine this? – roozbubu Aug 12 '13 at 17:27
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/35304/discussion-between-roozbubu-and-danypata) – roozbubu Aug 12 '13 at 17:41
  • Sorry man, I don't have the source code for the project anymore. – danypata Aug 12 '13 at 17:46

0 Answers0