删除导航标题中搜索栏中的边框

时间:2014-08-05 17:19:04

标签: ios swift

我的导航栏看起来像下面附带的图像。如何删除黑色边框?

enter image description here

我生成的代码如下:

    var searchBar : UISearchBar = UISearchBar(frame: CGRectMake(-5, 0, 320, 44))
    searchBar.autoresizingMask = UIViewAutoresizing.FlexibleWidth
    searchBar.layer.borderWidth = 1
    searchBar.searchBarStyle = UISearchBarStyle.Minimal


    var searchBarView : UIView = UIView(frame: CGRectMake(0, 0, 310, 44))
    searchBarView.autoresizingMask = nil
    searchBarView.layer.borderWidth = 0;
    searchBarView.layer.borderColor = UIColor.clearColor().CGColor

   searchBar.delegate = self;
   searchBarView.addSubview(searchBar)

1 个答案:

答案 0 :(得分:1)

也许你也在视图上做了什么,

searchBar.layer.borderColor = UIColor.clearColor().CGColor