美文网首页
UIToolbar 简单用法

UIToolbar 简单用法

作者: seventhboy | 来源:发表于2018-03-01 10:45 被阅读15次
UIDatePicker *date=[[UIDatePicker alloc]init];

[date setLocale:[NSLocale localeWithLocaleIdentifier:@"zh-CH"]];
date.datePickerMode=UIDatePickerModeDate;

self.textfield.inputView=date;

UIToolbar *toolbar=[[UIToolbar alloc]init];

toolbar.barTintColor=[UIColor brownColor];

toolbar.frame=CGRectMake(0, 0, 320, 44);

UIBarButtonItem *item0=[[UIBarButtonItem alloc]initWithTitle:@"上一个" style:UIBarButtonItemStylePlain target:self action:@selector(click)];
UIBarButtonItem *item1=[[UIBarButtonItem alloc]initWithTitle:@"下一个" style:UIBarButtonItemStylePlain target:self action:@selector(click)];
UIBarButtonItem *item2=[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
UIBarButtonItem *item3=[[UIBarButtonItem alloc]initWithTitle:@"完成" style:UIBarButtonItemStylePlain target:self action:@selector(click)];
toolbar.items=@[item0,item1,item2,item3];

self.textfield.inputAccessoryView=toolbar;

相关文章

网友评论

      本文标题:UIToolbar 简单用法

      本文链接:https://www.haomeiwen.com/subject/nkcgxftx.html