문제

In the Calendar app on the iPhone, when displaying a day, you can switch to the next an previous day with a gray bar at the top.

My question is: which interface element would you use for that? UIToolbar, UITabbar or a UINavigationBar?

UINavigationBar provides pretty much what I need: the possibility to add a button at the left and at the right of the bar, plus a label in the middle. But actually, I don't really have a navigation hierarchy.

UIToolbar is, according to Apple's HIG, supposed to sit at the bottom of the screen. I wouldn't really mind if not for the fact that it has no border at the bottom and a small border at the top which makes the whole thing look pretty weird if placed at the top of the screen.

I haven't yet tried UITabbar, because it is intended for something very different from what I need.


Currently, I tend towards UINavigationBar, but the right way to do this is probably to roll my own UI element for this?

도움이 되었습니까?

해결책

The UI element in the calendar app is none of those. It is a UIView with two UIButton subviews and one or two UILabels for the day and date text. Apple may have written a custom UIView class and a custom UIViewController, but with something as simple as this, it's probably just a custom UIViewController that programmatically builds the view.

You're instincts on this are correct: the right way to do this is to roll your own.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top