0

Hi Guys here i am suffering issue of dynamic height of UITableview Programmatically. I have set Autolayout of all view without any error but lblDesc (UILabel) not expand with its size according to content. plz guide me

sometimes I do not need btnVideo (UIButton) so i have to hide btnVideo(UIButton) and dynamically all social networks UIButton come after lblDesc (UILabel)

Here i attached my code with only one view

UITableViewAutomaticDimension

https://drive.google.com/file/d/0B5mabdphYDhzWG9UMzM2MTV6cms/view?usp=sharing

7
  • check constraints properly and give the label lines 0, fixed font size and word wrap for aligning of overflow content and it will work. i cannot check your code because its in Xcode 8 and i have 7.3. if you can post with Xcode 7.3 i can definitely solve your problem. Commented Oct 3, 2016 at 17:45
  • @M.K. Thanks, response I did it i convert project in Xcode 7 plz see it let me know is my way is correct? proj link drive.google.com/file/d/0B5mabdphYDhzSXlDZjQ1Y0xvOVk/… but xcode 8 setCornerRadius not working in UITableview CALayer *btnLayer = [cell.btnUserPic layer]; [btnLayer setMasksToBounds:YES]; [btnLayer setCornerRadius:cell.btnUserPic.frame.size.height/2]; [btnLayer setBorderWidth:1.0]; [btnLayer setBorderColor:[[UIColor colorWithRed:45.0/255.0 green:189.0/255.0 blue:242.0/255.0 alpha:1.0] CGColor]]; Commented Oct 5, 2016 at 10:07
  • @M.K. plz see below question stackoverflow.com/questions/39874962/… Commented Oct 5, 2016 at 13:15
  • i think you want to show a list of feed with different layout and you are hiding some controls of a cell for specific situation and changing it. But there is a better way to achieve this without this much complication. You need to decide how much type of layout there can be and use different type of cell layout with multiple table view cells. By this your layout for one kind of cell will be simple and manageable. Am telling this because i saw your layout of the cell and output. Layout is complicated but the output does not need all elements every time. Make it simple and you can set constraint Commented Oct 6, 2016 at 1:42
  • @M.K. you are talking about my second question or current one ? you want to say that we need to use different custom cells in one UITableviewRow am i right? but how we can use many custom cells in one UITableviewRow? Commented Oct 6, 2016 at 4:53

1 Answer 1

1

You should use UITextView instead of UILabel.

Btw, never forget you setup constraints between text view and container views for all edges correctly, so according to your text size, the whole cell will be resized dynamically.

I have reviewed your code. tableview has correct setting. Just setup correct layout constraints so that table view could know how it should change the height of cell.

Cheers

Sign up to request clarification or add additional context in comments.

1 Comment

thanks for response but sometimes I do not need btnVideo (UIButton) so i have to hide btnVideo(UIButton) and dynamically all social networks UIButton come after lblDesc (UILabel)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.