How can I create a custom UIToolbar like component in a UITableViewController?
Posted
by Tony
on Stack Overflow
See other posts from Stack Overflow
or by Tony
Published on 2010-03-21T21:48:00Z
Indexed on
2010/03/21
21:51 UTC
Read the original article
Hit count: 698
I have a UITableViewController. I want a "toolbar-ish" component at the bottom.
I started by using a background image and a button. In interface builder, I added them to the bottom of the iPhone screen. The problem I ran into was that the background image and button scrolled with the table. I obviously need this fixed at the bottom.
Not finding too much direction online, I decided to customize a UIToolbar to look how I want since the position is fixed by default. In my initWithNibName for my UITableViewController, I have:
UIImage *shuffleButtonImage = [UIImage imageNamed:@"shuffle_button.png"];
NSArray* toolbarItems = [NSArray arrayWithObjects:
[[UIBarButtonItem alloc] initWithImage:shuffleButtonImage
style:UIBarButtonItemStylePlain
target:self
action:@selector(push:)],
nil];
[toolbarItems makeObjectsPerformSelector:@selector(release)];
self.toolbarItems = toolbarItems;
The problem I am running into now is that the "shuffleButtonImage" is not showing up properly. The shape of the button shows up fine but it is colored white and therefore does not look like the image.
Does anyone know why a "white image" would be showing instead of the actual image?
Also does it sound like a good idea to customize a UIToolbar or is there a simple way to ensure a fixed position "toolbar-ish" component.
To reiterate - my "toolbar-ish" component only needs to be one button at the button of my UITableView. The single button has a gradient color background that I create with an image.
© Stack Overflow or respective owner