在EKEventViewController中,在两个具有相同功能的位置编辑按钮

时间:2015-05-27 10:43:53

标签: ios iphone

两个“编辑”按钮的行为方式相同。所以我想删除一个编辑按钮。我怎样才能实现它?

//*****my code is here:  
    var eventDetail = EKEventViewController()  
    eventDetail.event = selectedEvent  
    eventDetail.allowsEditing = true  
    eventDetail.allowsCalendarPreview = true 
    eventDetail.delegate = self  
    var navController = UINavigationController(rootViewController:eventDetail)  presentViewController(navController, animated: true, completion: nil)  

1 个答案:

答案 0 :(得分:0)

可以通过将其删除两次来完成:

presentViewController(navController, animated: true) {
    eventDetail.navigationItem.leftBarButtonItem = nil
}

/////////////////

class EventViewController: EKEventViewController {

    override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(animated)
        navigationItem.leftBarButtonItem = nil
    }
}