我有一个UITableViewController。我想在底部有一个“toolbar-ish”组件。如何在UITableViewController中创建一个自定义的UIToolbar组件?
我开始使用背景图像和按钮。在界面生成器中,我将它们添加到了iPhone屏幕的底部。我遇到的问题是背景图像和按钮与表格一起滚动。我显然需要这个固定在底部。
在网上找不到太多方向,我决定自定义一个UIToolbar,看看我想怎么样,因为这个位置默认是固定的。在我的initWithNibName我的UITableViewController,我有:
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;
我遇到现在的问题是,“shuffleButtonImage”无法显示正确的。按钮的形状显示很好,但是它的颜色是白色的,因此看起来不像图像。
有谁知道为什么会显示“白色图像”而不是实际图像?
它也听起来像是一个好主意,定制UIToolbar还是有一个简单的方法来确保固定位置“工具栏 - ish”组件。
重申 - 我的“toolbar-ish”组件只需要在我的UITableView的按钮上有一个按钮。单个按钮具有渐变颜色背景,我使用图像创建。
我遇到了一些[麻烦](http://stackoverflow.com/questions/16438074/controlling-display-coordinates-of-view-item-added-to-toolbar)和[结束](http:///stackoverflow.com/a/16439123/766570)我应该从头开始创建自己的工具栏,但我不确定你是如何解决这个问题的? – abbood 2013-05-08 11:48:36