UI控件(UIToolbar)
生活随笔
收集整理的這篇文章主要介紹了
UI控件(UIToolbar)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
@implementation ViewController- (void)viewDidLoad {[super viewDidLoad];_toolbar = [[UIToolbar alloc]init];_toolbar.frame = CGRectMake(0, 0, 320, 45);//以標題命名的按鈕_barItem = [[UIBarButtonItem alloc]initWithTitle:@"Item1" style:UIBarButtonItemStyleDone target:self action:@selector(doClick)];//以圖片作為背景的按鈕UIImage *_image = [UIImage imageNamed:@"fresh.png"];_barItem1 = [[UIBarButtonItem alloc]initWithImage:_image style:UIBarButtonItemStylePlain target:self action:@selector(doClick)];NSMutableArray *array = [NSMutableArray array];[array addObject:_barItem];[array addObject:_barItem1];//在工具欄中添加按鈕
[_toolbar setItems:array animated:YES];[self.view addSubview:_toolbar];}-(void)doClick{NSLog(@"doClick");
}@end
?
轉載于:https://www.cnblogs.com/Fredric-2013/p/5208197.html
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的UI控件(UIToolbar)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Atitit.5gl 第五代语言编程语言
- 下一篇: 组件传值问题总结