🖥️
iOS App with Pop
UIKit Swift 5
UIKit Swift 5
  • iOS App development
  • Swift
    • Variable & Constant
    • Number & String
    • Operator
    • Array, Dictionary & Tuple
    • Enum
    • Optional
    • Function
    • Class & Struct
    • Branching
    • Loops
    • Error handler
    • Protocol
    • Extension
  • Create New Project
  • Introduction to Xcode
  • Scene-Based 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
  • What is weak?
  • Finish add item
  • Delete todo item
  • Edit todo item
  • Custom new layout
  • Adding new delegate
  • Refactor
  • Pushing edit view
  • Large navigation
  • Drag item
  • Drop item (in app)
  • Save data
  • Where to go from here?
Powered by GitBook
On this page

Add navigationBar with + button

PreviousTableViewDelegateNextAdd new item page

Last updated 2 years ago

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

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

ขั้นแรกให้เราเลือกที่ ViewController ใน document outline ก่อน จากนั้นกดที่เมนู 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 ด้วย Bar Button Item