iOS UISearchBar 设置光标颜色和取消按钮颜色

时间:2015-08-27 18:06:54   收藏:0   阅读:1673

这个问题其实可以取个巧路,大家都知道设置SearchBar的tintcolor的方法

searchBar.tintColor = [UIColor blueColor];

 

    [[UIBarButtonItem appearanceWhenContainedIn:[UISearchBar class], nil]

                         setTitleTextAttributes:

                         [NSDictionary dictionaryWithObjectsAndKeys:

                                                        [UIColor whiteColor],

                                                        UITextAttributeTextColor,

                                                        [NSValue valueWithUIOffset:UIOffsetMake(0, 1)],

                                                        UITextAttributeTextShadowOffset,nil]

                                       forState:UIControlStateNormal];

 

如此,取消按钮的颜色即为想要的颜色了!

原文:http://www.cnblogs.com/ycq-firstBlood/p/4763778.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!