views:

210

answers:

2

I wish I could show you all a picture, but I have two buttons on the top right of my nav bar and a refresh button on the left. The title is in the middle, but the first two letters are getting overwritten by one of the buttons on the right.

How do I 'push' my title (or titleview - either one) so that the title moves over a bit? I want to move it around 60 pixels to the right.

A: 

I don't think you can change the title's frame. Meaning you can only hack; 1) add some white space at the beggining. 2) leave the title empty, and create a new label - place that label over your navBar.

Hope that helps, that's what I could think of right now. ~ Natanavra.

natanavra
A: 

The code below does what I want - BUT - for some reason now, the buttons do not work. The code for the buttons is identical to what I used before (and what used to work) the only difference is that it is now stored in the 'tools' toolbar/array.

Any ideas on why my buttons are now deactivated?

// creating the two center buttons in the navigation bar
// create a toolbar to have two buttons in the right
UIToolbar* tools = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 0, 44.01)];

// create the array to hold the buttons, which then gets added to the toolbar
NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:5];


// create a non-bordered button (ends up looking like a title)
UIBarButtonItem *bi = [[UIBarButtonItem alloc] initWithTitle:@"Photos" style:UIBarButtonItemStylePlain   target:self action:NULL];
initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:NULL];
    [buttons addObject:bi];
[bi release];


// create a spacer
bi = [[UIBarButtonItem alloc]
      initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
[buttons addObject:bi];
[bi release];


// create another button with a camera icon
bi = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCamera target:self action:@selector(showPhotoPicker)];
bi.style = UIBarButtonItemStyleBordered;
[buttons addObject:bi];
[bi release];


// create a spacer
bi = [[UIBarButtonItem alloc]
      initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
[buttons addObject:bi];
[bi release];


// create another button with 'your photos'
bi = [[UIBarButtonItem alloc] initWithTitle:@"your photos" style:UIBarButtonItemStyleBordered   target:self action:@selector(showUserGallery)];
bi.style = UIBarButtonItemStyleBordered;
[buttons addObject:bi];
[bi release];
Miriam Roberts