Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

swift add navigation bar

override func viewDidLoad() {
    super.viewDidLoad()
    self.setNavigationBar()
}

func setNavigationBar() {
        let screenSize: CGRect = UIScreen.main.bounds
        let navBar = UINavigationBar(frame: CGRect(x: 0, y: 0, width: screenSize.width, height: 44))
        let navItem = UINavigationItem(title: "")
        let doneItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonItem.SystemItem.done, target: nil, action: #selector(dissmissView))
        navItem.rightBarButtonItem = doneItem
        navBar.setItems([navItem], animated: false)
        self.view.addSubview(navBar)
    }

@objc
    func dissmissView(){
        self.dismiss(animated: true, completion: nil)
    }
Comment

add navigation bar button swiftui

.navigationBarItems(
    leading: Button(action: {
        // Actions
    }, label: { Text("Button") }),

    trailing: Button(action: {
    // Actions
    }, label: { Image("Icon") })
)
Comment

swift add navigation bar

let navBar = UINavigationBar(frame: CGRect(x: 0, y: 0, width: view.frame.size.width, height: 44))
view.addSubview(navBar)

let navItem = UINavigationItem(title: "SomeTitle")
let doneItem = UIBarButtonItem(barButtonSystemItem: .done, target: nil, action: #selector(selectorName:))
navItem.rightBarButtonItem = doneItem

navBar.setItems([navItem], animated: false)
Comment

PREVIOUS NEXT
Code Example
Swift :: type String and int swift addition 
Swift :: how to clear text file swift 
Swift :: accessing tab bar item action swift 
Swift :: Swift Markup in Xcode 11 
Swift :: save file with % swift 
Swift :: swift extension Array with element 
Swift :: Create a Swift Array 
Swift :: swift how to set warning message 
Swift :: Swift Swift Function Return Values 
Swift :: swift uilabel font bold 
Swift :: Swift Handling Errors Using do-catch Statement 
Swift :: The Swift pod `qr_code_scanner` depends upon `MTBBarcodeScanner`, which does not define modules 
Swift :: swift hide button 
Swift :: bold world in text swift 
Swift :: how to debug before app launch swift 
Swift :: get absolution position of view in swift 
Swift :: swift singleton 
Swift :: Swift for vs while loop 
Swift :: how to print body moya swift 
Swift :: weather api in ios swift 5 
Swift :: swift print statement 
Swift :: protocol oriented programming 
Swift :: xamarin get textview by id 
Swift :: xcode enable a button after a text field is filled 
Swift :: swift toggle on change 
Ruby :: rails index name too long 
Ruby :: ruby reorder keys in hash 
Ruby :: how to create migration with uniqueness inrails 
Ruby :: ruby multiline comment 
Ruby :: ruby connect database 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =