在键盘上附加工具栏

-(UIView*)inputAccessoryView{

CGRectaccessFrame=CGRectMake(0,0,768,35);

UIToolbar*toolbar= [[UIToolbaralloc]initWithFrame:accessFrame];

UIButton*nextButton=[UIButtonbuttonWithType:UIButtonTypeCustom];

nextButton.tag=0;

nextButton.layer.cornerRadius = 5;//设置那个圆角的有多圆

[nextButtonsetFrame:CGRectMake(0,0,50,35)];

[nextButtonsetTintColor:[UIColorblackColor]];

[nextButtonsetTitleColor:[UIColorblackColor]forState:UIControlStateNormal];

[nextButtonsetTitle:@"Next"forState:UIControlStateNormal];

nextButton.titleLabel.font= [UIFontsystemFontOfSize:15];

[nextButtonaddTarget:selfaction:@selector(toolbarButton:)forControlEvents:UIControlEventTouchUpInside];

[toolbaraddSubview:nextButton];


UIButton*okButton=[UIButtonbuttonWithType:UIButtonTypeCustom];

okButton.tag=1;

okButton.layer.cornerRadius = 5;//设置那个圆角的有多圆

[okButtonsetFrame:CGRectMake(ScreenWidth-50,0,50,35)];

[okButtonsetTintColor:[UIColorblackColor]];

[okButtonsetTitleColor:[UIColorblackColor]forState:UIControlStateNormal];

[okButtonsetTitle:@"确定"forState:UIControlStateNormal];

okButton.titleLabel.font= [UIFontsystemFontOfSize:15];

[okButtonaddTarget:selfaction:@selector(toolbarButton:)forControlEvents:UIControlEventTouchUpInside];

[toolbaraddSubview:okButton];

returntoolbar;

}

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 上官网注册账号 首先来到环信的官网,然后登陆.没有账号先注册一个. 进去之后创建应用,如图 创建应用界面 点击确定...
    loneWolf01阅读 3,443评论 0 0
  • // //AppDelegate.m //QQ播放器 #import"AppDelegate.h" #import...
    金牛忘忧阅读 2,885评论 0 1
  • 由于系统自带AlertView带输入框样式不太美观,决定自定义类似系统带有输入框样式AlertView,可根据需求...
    远航Yang阅读 3,544评论 0 0
  • 最近公司要开发一款基金销售软件,首页采用的是类似今日头条的头部滚动视图。 具体实现如下: 创建一个新类,继承于UI...
    iOS兽花阅读 4,918评论 0 0
  • 1. 为什么要使用模块化? 前端项目越来越复杂,代码日益庞大,迫切需要模块化来组织代码。模块化可以解决命名冲突,提...
    guidetheorient阅读 1,553评论 0 0