Dynamic height TableView in a Scroll View

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ก.พ. 2025

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

  • @DivyeshGondaliya
    @DivyeshGondaliya  3 ปีที่แล้ว

    Collectionview inside Scrollview th-cam.com/video/MGQPRuoTdVo/w-d-xo.html

  •  6 หลายเดือนก่อน

    Your video is still a solution. Thank you :)

  • @guilhermerangel7119
    @guilhermerangel7119 8 หลายเดือนก่อน +1

    MUITO BOM ME SALVOU, MUITO OBRIGADOOO!!!!! 👍👍👍👍

    • @DivyeshGondaliya
      @DivyeshGondaliya  7 หลายเดือนก่อน

      Hey there! If you enjoyed this video, don't forget to hit the like button and subscribe to my channel for more amazing content. And make sure to click the bell icon so you never miss an update! Thanks for your support! 😊

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

    Loved your video. Thank you.

    • @DivyeshGondaliya
      @DivyeshGondaliya  2 ปีที่แล้ว

      please don't forget to like and subscribe to our channel Thank you for watching ....🙂

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

    Brilliant!!!! I've been struggling with this issue for a long time and finally, it works!

    • @DivyeshGondaliya
      @DivyeshGondaliya  4 ปีที่แล้ว

      Thank you for watching video. please do like and subscribe to this channel

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

    02:08 how yellow view turned to gray? I don't understand what you did in 02:08

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

      there i remove uiview height constant which is under the scrollview please don't forget to subscribe !!!

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

      @@DivyeshGondaliya why? do i need to remove it too if I didn't get red error constraints?

    • @DivyeshGondaliya
      @DivyeshGondaliya  3 ปีที่แล้ว

      @@nurlanakylbekov7266 yes you have to remove it because we have to give scrollview dynamic hight

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

    Thanks man, you saved my life

    • @DivyeshGondaliya
      @DivyeshGondaliya  4 ปีที่แล้ว

      DON'T FORGET TO SUBSCRIBE and hit the notification bell for more updates! 💕

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

      @@DivyeshGondaliya sure

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

    Thank you very much, it's very useful

    • @DivyeshGondaliya
      @DivyeshGondaliya  3 ปีที่แล้ว

      welcome 😊 please don't forget to subscribe

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

    Thanks for your tutorial , but i have 1 question , if 1 viewcontroller i have 2 uitableview and i want 2 uitableview have contentsize , how cant i do that ??

    • @DivyeshGondaliya
      @DivyeshGondaliya  4 ปีที่แล้ว

      here is the solution ....
      don't forgot to like and subscribe ..
      override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?){
      if(keyPath == "contentSize") && object is UITableView
      {
      if let newvalue = change?[.newKey]
      {
      if self.tableView == object as? UITableView
      {
      let newsize = newvalue as! CGSize
      self.tableHeight.constant = newsize.height
      }
      }
      }
      }

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

      @@DivyeshGondaliya Oh mann this saved my life. Thankssss

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

    How to implement this to expandable table view with some section ? its Same ? and I have 3 tabs to with table view

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

    thanks it helped me a lot

    • @DivyeshGondaliya
      @DivyeshGondaliya  3 ปีที่แล้ว

      Glad to hear that! Don't forget to subscribe us ...

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

    what if you want to apply let's say like animation when a specific cell appears ?????????????????????

    • @DivyeshGondaliya
      @DivyeshGondaliya  3 ปีที่แล้ว

      you can apply animation in a cell like normal tableview cell size is automatically increase ir decrease according

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

    This was very helpful. Thanks a lot.
    Will it still work with each cell having an expandable view?

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

    Can I give me my project to solve the problem of not being able to scroll? Is the interface of the playback menu

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

    Amazing , Thankss !

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

    Thanks For Solution @divyesh

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

    Hi! Great video, I have a question that I'm struggling with. Suppose I have the same case but I need three TableViews in the same viewController, all of them with dynamic height, how should I fix or implement that? Thanks!!

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

      here is the solution for you
      override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?){
      if(keyPath == "contentSize"){
      if let tbl = object as? UITableView
      {
      if tbl == self.tbl_view
      {
      if let newvalue = change?[.newKey] {
      let newsize = newvalue as! CGSize
      self.tbl_view_height.constant = newsize.height
      }
      }
      }
      }
      }

    • @vietsublyrics104
      @vietsublyrics104 3 ปีที่แล้ว

      @@DivyeshGondaliya Hi! Thanks for your tutorial, I also have problem with multiple tableview, Can you help me fix it. Here is my source code.
      override func viewWillAppear(_ animated: Bool) {
      super.viewWillAppear(animated)
      self.tblView.addObserver(self, forKeyPath: "contentSize", options: .new
      , context: nil)
      self.tblView2.addObserver(self, forKeyPath: "contentSize", options: .new
      , context: nil)
      }
      override func viewWillDisappear(_ animated: Bool) {
      super.viewWillDisappear(animated)
      self.tblView.removeObserver(self, forKeyPath: "contentSize")
      self.tblView2.removeObserver(self, forKeyPath: "contentSize")
      }
      override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
      if keyPath == "contentSize" {
      if let tbl = object as? UITableView {
      if tbl == tblView {
      if let newValue = change?[.newKey] {
      let newSize = newValue as! CGSize
      self.tblHeight.constant = newSize.width
      }
      } else {
      if let newValue = change?[.newKey] {
      let newSize = newValue as! CGSize
      self.tblHeight2.constant = newSize.width
      }
      }
      }
      }
      }

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

    Nice video but can you make video on dynamic collection view height with height constraint or any idea on how to achieve it with help of height constraint

    • @DivyeshGondaliya
      @DivyeshGondaliya  3 ปีที่แล้ว

      yes you can manage with height constraint for collection view height

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

    Thank you!! Brilliant solution

    • @DivyeshGondaliya
      @DivyeshGondaliya  4 ปีที่แล้ว

      please subscribe to channel for more video like this

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

    #1 solution!

    • @DivyeshGondaliya
      @DivyeshGondaliya  3 ปีที่แล้ว

      Thank you 😊 please don't forget to share and subscribe to our channel

  • @ThuyNguyen-gw1dt
    @ThuyNguyen-gw1dt 4 ปีที่แล้ว +1

    Thanks so much for your help!

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

      Welcome ☺️ don't forget to like and subscribe to this channel ☺️

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

    Giving Error Instance member 'height' cannot be used on type 'ViewController' Inside Observer

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

      remove the "class" after override function declaration. Do this " override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {}"

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

    hai thanks for the video, but what if my scrollview not resize its content size?

  • @rafeeqrahman9608
    @rafeeqrahman9608 3 ปีที่แล้ว

    could you make a video for this topic in collectionview (Collectionview in scrollview)

    • @DivyeshGondaliya
      @DivyeshGondaliya  3 ปีที่แล้ว

      here you go th-cam.com/video/MGQPRuoTdVo/w-d-xo.html don't forget to subscribe us ....

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

    need disable scrolling and:
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    let size = 10
    tableViewHeight.constant = CGFloat(size) * UITableViewCell().frame.size.height
    return size
    }

  • @mychoicebhajan1732
    @mychoicebhajan1732 3 ปีที่แล้ว

    Instance member 'tbl_height' cannot be used on type 'ViewController' Unable to solve issue plz suggest some thing went wrong

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

      I had the same error. Check if you have selected: "override class func observeValue...." instead of "override func observeValue...". Remove the class.

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

    The tableview height is not increasing? Please help me to solve the issue?

    • @DivyeshGondaliya
      @DivyeshGondaliya  4 ปีที่แล้ว

      Please do all the step which i show in video

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

    thankyou so much

    • @DivyeshGondaliya
      @DivyeshGondaliya  4 ปีที่แล้ว

      Please don't forgot to subscribe us ....

  • @HamidAli-dc9iq
    @HamidAli-dc9iq 4 ปีที่แล้ว +4

    scrolling not working in my case

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

    Thanks.. I was looking for this exactly. Can you also provide the source code

    • @DivyeshGondaliya
      @DivyeshGondaliya  4 ปีที่แล้ว

      sure please give me a email id i will send it to you

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

    cool~

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

    please use camleCase

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

    Can you please send me the cide

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

      share your email here i send you the code

    • @saikrishna-qo3yl
      @saikrishna-qo3yl 4 ปีที่แล้ว +1

      @maninder If u received the source code please send it to me

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

      @@agung_laksana check your mail don't forget to subscribe us

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

    Github project?

    • @DivyeshGondaliya
      @DivyeshGondaliya  4 ปีที่แล้ว

      share your email i will send you project

  • @wangshangming10
    @wangshangming10 2 ปีที่แล้ว

    My green view is not scrollable, does anyone have the same issue?
    Update, it works on iPhone SE simulator but not iPhone 14

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

    Tanto lío para hacer solo eso?? 😂

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

    I have a problem

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

      The tableview height is not increasing

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

      @@patelmaheshumeshbhai4230 please chek your tableview constant

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

      @@DivyeshGondaliya Thanks a lot 😎😎

    • @DivyeshGondaliya
      @DivyeshGondaliya  4 ปีที่แล้ว

      @@patelmaheshumeshbhai4230 welcome please don't forget to subscribe us

  • @chithian5281
    @chithian5281 3 ปีที่แล้ว

    it doesn't work

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

    On this line: self.tbl_height.constant = newSize.height
    I get this error: Instance member 'tbl_height' cannot be used on type 'ViewController'
    What does this mean

    • @syamilys9799
      @syamilys9799 3 ปีที่แล้ว +3

      i got the same error , Can anybody help?

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

      any help on this error please?

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

      I had the same error. Check if you have selected: "override class func observeValue...." instead of "override func observeValue...". Remove the class.

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

    thank you so much

    • @DivyeshGondaliya
      @DivyeshGondaliya  7 หลายเดือนก่อน

      Hey there! If you enjoyed this video, don't forget to hit the like button and subscribe to my channel for more amazing content. And make sure to click the bell icon so you never miss an update! Thanks for your support! 😊