在键盘上附加工具栏

-(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;

}

你可能感兴趣的:(在键盘上附加工具栏)