narahari_arjun
narahari_arjun

Reputation: 643

Custom NavigationBar in swift

I am very much new to swift and ios so i need my doubts to be cleared for the below concept

I have created a view with a button having background image of back arrow and on button action i am going back to the previous controller which is the Login, is it safe to do it this way instead of using NavigationController??

@IBAction func onBackPressed(sender: AnyObject) {
    let aaa : Login =
    self.storyboard?.instantiateViewControllerWithIdentifier("Login")   
    as! Login

    self.presentViewController(aaa, animated: true, completion: nil)
}

Thanks

Upvotes: 0

Views: 53

Answers (1)

Kishore Kumar
Kishore Kumar

Reputation: 4375

Navigation controller is best when you want to push to next View Controller.

(i.e) Navigation Controller ->View Controller ->View Controller[for Push].

So my suggestion is if you want to come back to previous view controller use Navigation Controller

When you want to present a new View Controller that time no need.

Upvotes: 1

Related Questions