🖥️
iOS App with Pop
Swift 4
Swift 4
  • iOS App development
  • Create New Project
  • Introduction to Xcode
  • App's life cycle
  • UIViewController
  • Storyboard
  • First Run
  • Display todo list
  • Basic Auto Layout
  • MVC
  • Model
  • Binding TableView
  • Binding TableViewCell
  • TableViewDelegate
  • Add navigationBar with + button
  • Add new item page
  • TextField and Switch
  • Binding action
  • Add mock item to todo list
  • Finish add item
  • Delete todo item
  • Edit todo item
  • Custom new layout
  • Adding new delegate
  • Refactor
  • Save data
  • Pushing edit view
  • Large navigation
  • Drag item
  • Drop item (in app)
  • Where to go from here?
Powered by GitBook
On this page

Add navigationBar with + button

PreviousTableViewDelegateNextAdd new item page

Last updated 6 years ago

ใส่ชื่อแอพ เพิ่มปุ่มบวก

เรามาเพิ่มให้มี แถบด้านบนกันดีกว่า จะได้เตรียมไว้ทำหน้าเพิ่ม todo item ด้วย

ขั้นแรกให้เราเลือกที่ ViewController ก่อน กดที่เมนู Editor -> Embed In -> Navigation Controller

เราจะได้ Navigation Controller มาหนึ่งอัน ชี้มาที่ ViewController

จากนั้นให้เราตั้งชื่อ โดยการเลือกที่ Navigation Item ของ ViewController ที่เพิ่มมา เลือก Attributes Inspector ใส่ Todo ลงใน Title property

เพิ่มปุ่ม Add โดยการลาก Bar Button Item จาก Object Library ไปที่มุมขวาของ Navigation Bar

เลือก System Item เป็น Add ปุ่มจะเปลี่ยนเป็นเครื่องหมาย +

เมื่อรันแอพอีกครั้งจะได้หน้าตาแบบนี้

ตั้ง Title ใน Attributes Inspector
เพิ่มปุ่ม Add