Skip to content

Commit

Permalink
Merge pull request #14 from nathanb95/feature/navigationtouchup
Browse files Browse the repository at this point in the history
Added functions for nav bars
  • Loading branch information
okrek6 committed Oct 14, 2018
2 parents 0aef76a + f441114 commit 84a0783
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 22 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "SplitNote/homeViewController.swift"
timestampString = "561165850.807478"
timestampString = "561174749.806522"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "35"
endingLineNumber = "35"
landmarkName = "viewDidLoad()"
landmarkType = "7">
landmarkName = "unknown"
landmarkType = "0">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
Expand Down
29 changes: 27 additions & 2 deletions SplitNote/folderViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,14 @@ class FolderViewController: UIViewController, UITableViewDataSource, UITableView

navigationController?.navigationBar.barTintColor = SplitNoteDarkPurple

navigationItem.title = "Folders"
navigationItem.title = "FOLDERS"
navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white]
navigationItem.rightBarButtonItem = add

let createFolder = UIBarButtonItem(title: "ADD", style: .done, target: self, action: #selector(addFolder))

createFolder.tintColor = .white

navigationItem.rightBarButtonItem = createFolder

navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
navigationController?.navigationBar.shadowImage = UIImage()
Expand Down Expand Up @@ -90,4 +95,24 @@ class FolderViewController: UIViewController, UITableViewDataSource, UITableView
return cell
}

@objc func addFolder(){

let alert = UIAlertController(title: "Create a New Folder", message: nil, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))

alert.addTextField(configurationHandler: { textField in
textField.placeholder = "Input the title here..."
})

alert.addAction(UIAlertAction(title: "Save", style: .default, handler: { action in

if let name = alert.textFields?.first?.text {
print("Your name: \(name)")
}
}))

self.present(alert, animated: true)

}

}
52 changes: 35 additions & 17 deletions SplitNote/newNoteViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,15 @@ class NewNoteViewController: UIViewController {
navigationItem.title = "SplitNote"
navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white]

let home = UIBarButtonItem(title: "HOME", style: .done, target: self, action: #selector(goHome))

let folders = UIBarButtonItem(title: "FOLDERS", style: .done, target: self, action: #selector(goToFolders))

home.tintColor = .white
folders.tintColor = .white

navigationItem.leftBarButtonItem = home
navigationItem.rightBarButtonItem = files
navigationItem.rightBarButtonItem = folders

navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
navigationController?.navigationBar.shadowImage = UIImage()
Expand All @@ -226,23 +233,23 @@ class NewNoteViewController: UIViewController {

}

let home: UIBarButtonItem = {
let h = UIBarButtonItem()
h.title = "HOME"
h.tintColor = .white
return h
}()
// let home: UIBarButtonItem = {
//
// let h = UIBarButtonItem()
// h.title = "HOME"
// h.tintColor = .white
// return h
//
// }()

let files: UIBarButtonItem = {
let f = UIBarButtonItem()
f.title = "FILES"
f.tintColor = .white
return f
}()
// let files: UIBarButtonItem = {
//
// let f = UIBarButtonItem()
// f.title = "FILES"
// f.tintColor = .white
// return f
//
// }()

@IBAction func enterText(_ sender: Any?) {

Expand Down Expand Up @@ -277,4 +284,15 @@ class NewNoteViewController: UIViewController {

}

@objc func goHome() {

self.present(homeViewController(), animated: true, completion: nil)


}

@objc func goToFolders(){
self.present(UINavigationController(rootViewController: FolderViewController()), animated: true, completion: nil)
}

}

0 comments on commit 84a0783

Please sign in to comment.