Skip to content

Commit

Permalink
Merge pull request #3 from kwosu87/option_for_done_button
Browse files Browse the repository at this point in the history
Provide an option for adding 'Done Button'
  • Loading branch information
devxoul committed Feb 17, 2016
2 parents d424320 + 7ac4173 commit b8aa6d6
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Carte/CarteViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,16 @@ public class CarteViewController: UITableViewController {
}

public override func viewWillAppear(animated: Bool) {
if self.presentingViewController != nil && self.navigationItem.leftBarButtonItem == nil {
self.navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Done,
super.viewWillAppear(animated)

// pushed
if self.navigationController?.viewControllers.count > 1 {
self.navigationItem.leftBarButtonItem = nil
}
// presented
else if self.presentingViewController != nil && self.navigationItem.leftBarButtonItem == nil {
self.navigationItem.leftBarButtonItem = UIBarButtonItem(
barButtonSystemItem: .Done,
target: self,
action: "doneButtonDidTap"
)
Expand Down

0 comments on commit b8aa6d6

Please sign in to comment.