Guest User

Untitled

a guest
Oct 19th, 2018
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.33 KB | None | 0 0
  1. //App Delegate
  2. import UIKit
  3.  
  4. @UIApplicationMain
  5. class AppDelegate: UIResponder, UIApplicationDelegate {
  6.  
  7. var window: UIWindow?
  8.  
  9.  
  10. func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
  11. // Override point for customization after application launch.
  12. return true
  13. }
  14.  
  15. func applicationWillResignActive(_ application: UIApplication) {
  16. // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
  17. // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
  18. }
  19.  
  20. func applicationDidEnterBackground(_ application: UIApplication) {
  21. // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
  22. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
  23. }
  24.  
  25. func applicationWillEnterForeground(_ application: UIApplication) {
  26. // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
  27. }
  28.  
  29. func applicationDidBecomeActive(_ application: UIApplication) {
  30. // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
  31. }
  32.  
  33. func applicationWillTerminate(_ application: UIApplication) {
  34. // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
  35. }
  36.  
  37.  
  38. }
  39.  
  40. //ViewController
  41.  
  42. import UIKit
  43.  
  44. class ViewController: UIViewController {
  45.  
  46. @IBOutlet weak var userNameTextField: UITextField!
  47.  
  48. @IBOutlet weak var forgotPassword: UIButton!
  49.  
  50. @IBOutlet weak var forgotUsername: UIButton!
  51.  
  52. override func viewDidLoad() {
  53. super.viewDidLoad()
  54. // Do any additional setup after loading the view, typically from a nib.
  55. }
  56. /*
  57. override func didReceiveMemoryWarning() {
  58. super.didReceiveMemoryWarning()
  59. // Dispose of any resources that can be recreated.
  60. }
  61. */
  62. override func prepare(for segue: UIStoryboardSegue, sender: Any?)
  63. {
  64. guard let sender = sender as? UIButton else { return }
  65.  
  66. if sender == forgotPassword
  67. {
  68. segue.destination.navigationItem.title = "Forgot Password"
  69. } else if sender == forgotUsername {
  70. segue.destination.navigationItem.title = "Forgot Username"
  71. } else {
  72. segue.destination.navigationItem.title = userNameTextField.text
  73. }
  74. }
  75.  
  76. @IBAction func forgotUserNameButtonTapped(_ sender: Any) {
  77. performSegue(withIdentifier: "ForgottenUserNameOrPassword", sender: forgotUsername)
  78. }
  79.  
  80. @IBAction func forgotPasswordButtonTapped(_ sender: Any) {
  81. performSegue(withIdentifier: "ForgottenUserNameOrPassword", sender: forgotPassword)
  82. }
  83. }
Add Comment
Please, Sign In to add comment