美文网首页
IOS7下UISearchBar 光标不出现的问题

IOS7下UISearchBar 光标不出现的问题

作者: 尘俗未了 | 来源:发表于2017-04-04 11:08 被阅读0次

去掉搜索框背景的代码(支持ios6/7/8)

for (UIView *view in self.mySeachBar.subviews) {
    if ([view isKindOfClass:NSClassFromString(@"UISearchBarBackground")]) {
        [view removeFromSuperview];
        break;
    }
    if ([view isKindOfClass:NSClassFromString(@"UIView")] && view.subviews.count > 0) {
        [[view.subviews objectAtIndex:0] removeFromSuperview];
        break;
    }
}

app支持ios7,在UINavBar 里面加入搜索框,结果光标一直出现不了。在stackoverflow网站搜索了一下,竟然有人遇到相同的问题。。。。

解决办法如下:

searchBar.tintColor = [UIColor blueColor];

原文地址:
http://stackoverflow.com/questions/19232296/cursor-not-displaying-in-uisearchbar-for-our-app

相关文章

网友评论

      本文标题:IOS7下UISearchBar 光标不出现的问题

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