10

I have done some digging and can't seem to get anything useful.

What I am trying to do is pretty basic but I'm not sure if their is:

1. An easier way

2. Or if Apple will give it a "no no"

I have a view that is controlled via UINavigationController (obviously from the title of this post) and in it has an object/view.

The view is fairly congested already with content. Not really congested but no more room to fit things comfortably.

The user needs to be able to rate this object by using a different number of starts (1-5).

The ideal way I would see this happening would be to have 5 star buttons (with images of course) set in the UINavigationBar title position (centered).

So look something like this:

___________________________________
|                                 |
| Back      * * * * *     Action  |
|_________________________________|
|                                 |
|         view down here          |
|                                 |

Any input would be very much appreciated and as always, thank you for your time!

random
  • 8,568
  • 12
  • 50
  • 85

3 Answers3

22

You can just create your custom widget with the 5 star rating functionality and add it to the navigationItem

self.navigationItem.titleView = customWidget;
Paul.s
  • 38,494
  • 5
  • 70
  • 88
1
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button addTarget:self
           action:@selector(chooseDataCenter:)
 forControlEvents:UIControlEventTouchUpInside];
[button setTitle:@"点我选择数据中心>" forState:UIControlStateNormal];
button.frame = CGRectMake(0, 0, 160.0, 40.0);

self.navigationItem.titleView =button;
Gank
  • 4,507
  • 4
  • 49
  • 45
1

On top of my head, my suggestion would be that you try using UIToolbar and set it on top, and make it look like a navigationBar. It's fairly easy to implement it and add UIButtons and actions to it.

Legolas
  • 12,145
  • 12
  • 79
  • 132
  • Do you think that possibly creating a view, adding the toolbar to it with the buttons then setting UInavigationController title to that view. – random Dec 30 '11 at 05:25
  • You can create a view, not use a `UINavigationBar` (and you don't need to use the `navigationController.title` methods), and use `UIToolbar` instead with frame size (0,0,320,44), and add `UIButtons` as subview to it. – Legolas Dec 30 '11 at 05:29