2

I've got a very stubborn UIToolbar, who refuses to change its height no matter how may different methods I try.

I've seen this question and it does not work for me

Is there a way to change the height of a UIToolbar?

It is a toolbar for my cameraOverlayView while taking a picture. here is what I've tried and has not worked:

-Adjusting its current frame's height

-Creating a new CGRect for its frame

-Subclassing UIToolbar and editing its drawRect function

- (void)drawRect:(CGRect)rect
{
  //Create a rectangle for the toolbar
  CGRect rectArea = CGRectMake(0, 0, 320, 70);
  [self setFrame:rectArea];

}

Is there some property I'm unaware of which prevents a UIToolbar from adjusting its height?

Community
  • 1
  • 1
FierceMonkey
  • 1,964
  • 1
  • 16
  • 22
  • Ignore what I prev. said: http://stackoverflow.com/questions/2135407/is-there-a-way-to-change-the-height-of-a-uitoolbar – Dair May 16 '11 at 03:47
  • 'setFrame:' should work fine. If you are going to override drawRect you should probably call '[super drawRect:rect]' – Joe May 16 '11 at 04:18

1 Answers1

2

Just Follow How to change the height of UIToolbar

Community
  • 1
  • 1
Mehul Mistri
  • 15,037
  • 14
  • 70
  • 94
  • I've seen that question and answer and I've put that exact code numerous places in my program but the height won't change. I know it does work in normal UIViews, but I think the fact that this is a cameraOverlayView is messing with the toolbar's height. – FierceMonkey May 16 '11 at 17:12
  • 1
    Well I figured out my problem, I was setting the height before the view was loaded, and the uitoolbar was created via the xib file. So your answer is correct, I just had to put it in the right place! Thanks for your help. – FierceMonkey May 17 '11 at 05:19