我找到了,上面左邊的UINavigationBarBackIndicatorView
!我想刪除它或CGRect.Zero
。謝謝!在iOS中,如何在UINavigationBar中刪除UINavigationBarBackIndicatorView?
地址:
在層次結構添加leftItem前:
後,我在層次結構添加一個leftItem:
let button = UIButton(frame: CGRect(x: 0, y: 0, width: 44, height: 44))
let image = UIImage(named: "search-icon-blue")
button.setImage(image, for: .normal)
let leftItem = UIBarButtonItem(customView: button)
let spaceItem = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil)
spaceItem.width = -10
navigationItem.leftBarButtonItems = [spaceItem, leftItem]
當按鈕被點擊時,它變得黑暗! 但是當我點擊左側區域時它不會變暗,我想原因是它在上面的UINavigationBarBackIndicatorView! 所以,我想刪除它!
你是怎麼加入這個'UINavigationBar'? – nayem
此代碼位於UIViewController中,UIViewControler是UINavigationController的RootViewController! – swordjoy
這裏'spaceItem'的用途是什麼? – nayem