1

enter image description here

I want to create the UI above. Specifically, a taller toolbar. But I need to do so in a way that the underlying UI (i.e. content view) displays accordingly (i.e. underneath the toolbar.

I am familiar with the new UIAppearance options in iOS 5. However, these seem to be more about skinning, not adjust sizes.

I imagine a could make the UI elements and add them to the window? But wouldn't that cause sizing issues with the content views. Seems hacky…

So, what would be the way to achieve this UI. Ideally supporting back to iOS 4.2. But an iOS 5 solution is welcome.

2 Answers 2

1

I'm not pretty sure what functions you want to replicate/make, but you can change the height of your toolbar with this:

[toolBar setFrame:CGRectMake(0, 50, 320, 60)];

This will create for you, a toolbar with 60px of height. Let me know if it's what you want.

5
  • I've seen answers regarding this. But as noted, seems hackish and ill advised based on the docs. Aug 10, 2012 at 17:16
  • UIToolbar is a UIView like any other, in fact almost every UI have it's inheritance. Is hackish do this? UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 50, 320, 60)]; You're simply telling a button where it belongs. Same thing with the toolbar. UIToolbar *toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 50, 320, 60)]; Your concern is a fear to get rejected by Apple? or are you trying to find a simpler method? Try with IB, i believe that almost all properties you can change there.
    – NSPunk
    Aug 10, 2012 at 17:29
  • I suppose the following line taken from the Mobile HIG in regard to the device rotation concerned me - Don’t specify the height of a toolbar programmatically; instead, you can take advantage of the UIBarMetrics constants to ensure that your content fits well. Aug 10, 2012 at 18:08
  • Yes, some controls are indeed already done, so you won't have to change it. But you can always set any UIView frame to whatever you want. I don't know what app is that in the image you provided, but my guess is, it's an UIView customized to it's need.
    – NSPunk
    Aug 10, 2012 at 18:19
  • You can't change the height in IB (that field is inactive). I also confirmed with the docs and other posts that you should not change the height. The right way to do this is to create a custom toolbar, which I don't want. Thanks for you help. Aug 11, 2012 at 14:57
0

Since Apple allow you to customized their Controls, the only way to customize is to use customized controls. One way is to use Custom-UIToolbar derived from UIView.

3
  • See Guidelines that Apply Generally to Controls section.
    – DShah
    Aug 10, 2012 at 17:51
  • Sorry I have attached Mac OS link. Here is iOS HIG link : developer.apple.com/library/ios/#documentation/userexperience/…
    – DShah
    Aug 10, 2012 at 17:52
  • Thanks. This does answer my question - create a custom control. But I am trying to stay native, so I will probably just end up using the default UIToolbar height. Aug 11, 2012 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.