码迷,mamicode.com
首页 > 移动开发 > 详细

iOS 修改toolbar里面文字的字体和大小

时间:2014-07-19 08:06:31      阅读:257      评论:0      收藏:0      [点我收藏+]

标签:style   http   color   使用   os   art   

使用NSDictionaty来设置文本的属性:

NSDictionary * attributes = @{NSFontAttributeName: [UIFont fontWithName:@"Heiti SC" size:20]};
    [confirmBarButton setTitleTextAttributes:attributes forState:UIControlStateNormal];

完整代码:

    self.inputToolbar = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, 320, 50)];
    self.inputToolbar.translucent = NO;
    self.inputToolbar.barTintColor= [UIColor colorWithRed:26.0/255.0 green:194.0/255.0 blue:97.0/255.0 alpha:1];
    self.inputToolbar.tintColor = [UIColor whiteColor];
    
    UIBarButtonItem *confirmBarButton = [[UIBarButtonItem alloc] initWithTitle:@"Confirm" style:UIBarButtonItemStylePlain target:self action:@selector(doneKeyboard)];
    NSDictionary * attributes = @{NSFontAttributeName: [UIFont fontWithName:@"Heiti SC" size:20]};
    [confirmBarButton setTitleTextAttributes:attributes forState:UIControlStateNormal];
    
    UIBarButtonItem *spaceBarButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:@selector(doneKeyboard)];
    
    self.inputToolbar.items = [NSArray arrayWithObjects: spaceBarButton, confirmBarButton, spaceBarButton, nil];
    self.textView.inputAccessoryView = self.inputToolbar;

参考链接:http://stackoverflow.com/questions/2720733/how-do-you-set-the-font-size-on-a-uibarbuttonitem

iOS 修改toolbar里面文字的字体和大小,布布扣,bubuko.com

iOS 修改toolbar里面文字的字体和大小

标签:style   http   color   使用   os   art   

原文地址:http://blog.csdn.net/willyang519/article/details/37937937

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!