บทความ

กำลังแสดงโพสต์จาก สิงหาคม, 2019

[Swift] การเรียก/ส่งไป View แบบติด Navigation bar

การเรียก/ส่งไป View แบบติด Navigation bar (Present view controller with a navigation bar) เวลาเราต้องการแสดงหน้า View อื่นและต้องการให้มีการแสดง Navigation bar ด้วยนั้นเขียนโค้ดตามด้งนี้ Swift 5.x guard let myVC = self.storyboard?.instantiateViewController(withIdentifier: "MyViewController") else { return } let navController = UINavigationController(rootViewController: myVC) self.navigationController?.present(navController, animated: true, completion: nil) และนี้เป็นวิธีการส่งกลับไปหน้าเดิม self.dismiss(animated: true, completion: nil)