美文网首页
在键盘上附加工具栏

在键盘上附加工具栏

作者: gogo小小酥 | 来源:发表于2018-02-25 16:50 被阅读6次

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

    }

    相关文章

      网友评论

          本文标题:在键盘上附加工具栏

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