How to open a new view with a button programatically (UIKit, Swift 2023)

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 ม.ค. 2025
  • In this video we will learn how to programmatically open a new UIViewController with a UIButton. We will learn how to do it modally (pop up) and also push it into a navigation controller stack.
    If this video helped out and you want to see more iOS/Swift videos,
    please consider subscribing.
    If you liked the video, leave a like or comment!
    If coding is too hard, you can hire me:
    www.fiverr.com...

ความคิดเห็น • 15

  • @noisy_knives6790
    @noisy_knives6790 11 หลายเดือนก่อน +2

    Gigantic thanks! I wasn't understanding using Tab Bar and Navigation Bar together before see this video. And now I'm cured! 🤩

  • @kuchumovnikita7977
    @kuchumovnikita7977 ปีที่แล้ว +2

    Your videos is very helpful. Please keep it up!
    Really need video for networking in Swift
    Maybe like video series how to send a request, get data, parse it and put it into a tableview/collectionView
    Thank you!

  • @sheetalpahadi
    @sheetalpahadi 9 หลายเดือนก่อน

    so simple you made it!

  • @nathatkuanthanom9485
    @nathatkuanthanom9485 ปีที่แล้ว +1

    very helpful

  • @rabbit467
    @rabbit467 ปีที่แล้ว

    ty, bro

  • @GoodFriend845
    @GoodFriend845 ปีที่แล้ว

    how to learn how to solve tasks ? and how to develop thinking into programming on swift

  • @michaeldoscher3252
    @michaeldoscher3252 ปีที่แล้ว

    This still work?

  • @anthonybarbedet6915
    @anthonybarbedet6915 ปีที่แล้ว

    thread 1:"unable to activate constraint with anchor "

    • @Codebrah
      @Codebrah  ปีที่แล้ว

      Send me the code in your setupUI() function pls!

    • @anthonybarbedet6915
      @anthonybarbedet6915 ปีที่แล้ว

      @@Codebrah private func setupUI() {
      self.view.backgroundColor = .systemGreen
      self.button.translatesAutoresizingMaskIntoConstraints = false
      NSLayoutConstraint.activate([
      button.centerXAnchor.constraint(equalTo: self.view.centerXAnchor),
      button.centerYAnchor.constraint(equalTo: self.view.centerYAnchor),
      button.widthAnchor.constraint(equalToConstant: 200),
      button.heightAnchor.constraint(equalToConstant: 44)
      ])}

    • @anthonybarbedet6915
      @anthonybarbedet6915 ปีที่แล้ว

      @@CodebrahI also want to say I really like your videos (french developper don't explain as well as u )

    • @Codebrah
      @Codebrah  ปีที่แล้ว

      @@anthonybarbedet6915 Okay thats what I thought was going on!
      Before you put: self.button.translatesAutoresizingMaskIntoConstraints = false
      You need to put: self.view.addSubview(button)
      So in total it will look like:
      private func setupUI() {
      self.view.backgroundColor = .systemGreen
      self.view.addSubview(button)
      self.button.translatesAutoresizingMaskIntoConstraints = false
      NSLayoutConstraint.activate([
      button.centerXAnchor.constraint(equalTo: self.view.centerXAnchor),
      button.centerYAnchor.constraint(equalTo: self.view.centerYAnchor),
      button.widthAnchor.constraint(equalToConstant: 200),
      button.heightAnchor.constraint(equalToConstant: 44)
      ])}
      Goodluck!

    • @Codebrah
      @Codebrah  ปีที่แล้ว +1

      @@anthonybarbedet6915 Appreciate that my friend!