自定义UISearchBar的背景图
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                自定义UISearchBar的背景图
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.                        
                                ?
可以重寫(xiě)UISearchBar,然后調(diào)用layoutSubviews這個(gè)方法。| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | - (void)layoutSubviews { ????UITextField *searchField; ????NSUInteger numViews = [self.subviews count]; ????for(int i = 0; i < numViews; i++) { ????????if([[self.subviews objectAtIndex:i] isKindOfClass:[UITextField class]]) { ????????????searchField = [self.subviews objectAtIndex:i]; ????????} ????} ????if(!(searchField == nil)) { ????????searchField.textColor = [UIColor whiteColor]; ????????[searchField.leftView setHidden:YES]; ????????[searchField setBackground: [UIImage imageNamed:@"SearchBarBackground.png"] ]; ????????[searchField setBorderStyle:UITextBorderStyleNone]; ????} ????? ????[super layoutSubviews]; } | 
轉(zhuǎn)載于:https://www.cnblogs.com/ranger-jlu/p/3877925.html
總結(jié)
以上是生活随笔為你收集整理的自定义UISearchBar的背景图的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
 
                            
                        - 上一篇: 模拟TAB键
- 下一篇: .net利用程序集的GUID解决程序只能
