更改键盘工具栏Objective-C的标题颜色

Abhimanyu

我想更改键盘的标题颜色,toobar即(提交按钮),另一种方法是如何为键盘工具栏添加图像。TIA

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

[keyboardToolbar sizeToFit];

keyboardToolbar.translucent=NO; //if you want it.

keyboardToolbar.barTintColor = [UIColor lightGrayColor];

_txtCommentView.inputAccessoryView = keyboardToolbar;

keyboardToolbar.items = [NSArray arrayWithObjects:
                             [[UIBarButtonItem alloc]initWithTitle:@"Submit" style:UIBarButtonItemStyleBordered target:self action:@selector(submitClicked:)],
                              nil];
缺口

如果要更改整个应用程序工具栏中的更改,请使用

[UIToolbar appearance].tintColor = [UIColor redColor];
[UIToolbar appearance].barTintColor = [UIColor greenColor];

您也可以使用以下代码进行更改:

 NSDictionary *attributes = @{
                                 NSForegroundColorAttributeName: [UIColor colorWithRed:220.0/255.0 green:104.0/255.0 blue:1.0/255.0 alpha:1.0],

                                 NSFontAttributeName: [UIFont fontWithName:@"Arial" size:16.0]
                                 };
    [[UIBarButtonItem appearance] setTitleTextAttributes:attributes forState:UIControlStateNormal];

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章