1
동적으로 Navigation Bar
을 만들고 왼쪽에 Cancel
버튼을 설정해야합니다.UINavigationItem에 작업을 추가하는 방법은 무엇입니까?
나는 그것을
var navBar: UINavigationBar = UINavigationBar()
func setNavBarToTheView() {
navBar.frame = CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: 80.0)
navBar.backgroundColor = (UIColor.black)
let navTitle = UINavigationItem(title: "Camera")
let navCancel = UINavigationItem(title: "Cancel")
navBar.setItems([navCancel, navTitle], animated: true)
view.addSubview(navBar)
}
을하려고하지만 어떻게 내가 할 수있는이 Cancel
버튼에 액션 청취자를 추가하는 방법 코드가있다?