【发布时间】:2015-04-12 20:14:44
【问题描述】:
我有一个带有以下代码的工具栏;我想添加一个显示“工具”的图像,称为“toolsIcon.png”。
下面是我的代码:
//BottomBar
UIToolbar *toolbar = [[UIToolbar alloc] init];
toolbar.frame = CGRectMake(0, self.view.frame.size.height - 44, self.view.frame.size.width, 44);
[self.view addSubview:toolbar];
[toolbar release];
//TOOLBAR ITEMS
//button 1
UIBarButtonItem *tools = [[UIBarButtonItem alloc] initWithTitle:@"Tools" style:UIBarButtonItemStyleBordered target:self action:@selector(createToolView)];
[tools setTag:0];
//add the buttons to the toolbar
NSArray *buttons = [NSArray arrayWithObjects: tools,nil];
[toolbar setItems: buttons animated:YES];
//memory management for buttons - don't waste!
[tools release];
【问题讨论】:
-
看起来你没有使用 ARC,你确实应该使用。还是您只是在某个地方找到了代码?
-
停止使用它不再需要的版本试试这个。 stackoverflow.com/questions/9926978/…回复结果。
-
添加图片的代码在哪里?
-
这就是我的要求
标签: ios objective-c uitoolbar theos