Mam pasek narzędzi z poniższym kodem; Chciałbym dodać obraz, który wyświetla się za pomocą "Tools" Nazwany "toolsIcon.png".Jak wyświetlić obraz na pasku narzędzi za pomocą Objective-C
Poniżej jest mój kod:
//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];
Wygląda na to, że nie używasz ARC i naprawdę powinieneś. A może po prostu znalazłeś gdzieś kod? – marosoaie
Przestań używać wydania, nie jest już potrzebna Spróbuj tego. http://stackoverflow.com/questions/9926978/how-to-add-images-to-uitoolbar Powtórz wynik. –
gdzie jest kod, aby dodać obraz? –