How to increase the single row height without reloading UITableView or individual cells [Swift]?

O-mkar

I want to expand the row height and show the content inside. I show my content in view I want when I tap on a cell it should expand like showed in the image below but without reloading the UITableview.

IMAGE

What I have tried till now.

1) I tried expanding the view inside but it didn't work

2) I tried adding rowAtIndex it was becoming complicated

3) I tried changing change row height and scroll at index it worked fine but I don't want like that. (bad thing I have to reload the table view)

But i got many answers but it didn't address my issue as my data in the array(data source) is continuously updated if I refresh at specific index the data in the array at the index might be different it might show the wrong output.

Explanation

I mean I have an array of struct I keep on updating it in background once the data change and reload the table view but if the i reload the row at index and if the data in an array is already changed it might show duplication correct? so i want to just change the height of the row without doing any reload.

Problem with reloading is

while expanding the data might change in the array. so i already created a view and all the info is preloaded once i tap the height of the cell should change from 45 to 76 and once i tap different cell again from last cell 76 to 45 and this cell 45 to 76.

Olivia Wilde

Table height can only be changed through delegates there is no other way to do it i will show you a simple way to do it.

Declare variable

var selectedIndex = NSIndexPath()

Inside didSelectRowAtIndexPath reload selected cell

func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {

        selectedIndex = indexPath
        tableView.reloadRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Fade)

    }

Inside heightForRowAtIndexPath return size

func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
    if indexPath == selectedIndex {

        return 100 //Size you want to increase to
    }
    return 50 // Default Size
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to increase the height of individual options in Semantic UI?

From Dev

How to dynamically increase height of scrollview based on uitableview

From Dev

Updating A Specific Row In UITableView Without Reloading The Whole Table

From Dev

UItableView not reloading data swift

From Dev

Autofit Row Height on Both: Column with Merged Cells AND Column with Single Cells

From Dev

How to set height constraint of UITableView according to dynamic height cells?

From Dev

How to increase height for a custom UINavigationBar class in Swift

From Dev

How to resize the UITableView row height in Objective C

From Dev

UITableView dynamic cell heights - reload height for single row

From Dev

How to hide specific cells in a static UItableview, in swift?

From Dev

How to hide specific cells in a static UItableview, in swift?

From Dev

Pull to Refresh in Swift not Reloading UITableView

From Dev

Pull to Refresh in Swift not Reloading UITableView

From Dev

How to programmatically increase UITableView cell's height in iPhone?

From Dev

How to set Dynamically UITableView height in Swift?

From Dev

Static UITableView, make a single cell with dynamic height in Swift

From Dev

How to customize UITableView separator when the cells got a custom height

From Dev

IOS UiTableView Cells how can I make it's height adjustable

From Dev

How combine multiple cells into a single row in SQL?

From Dev

iOS/Swift: Dynamic UITableViewCell row height with embedded UITableView not working

From Dev

How to increase the length of cells in a single column in a table using HTML?

From Dev

Swift - Reorder UITableView cells

From Dev

Swift : Clear UITableView Cells

From Dev

Swift - Fading cells in UITableView

From Dev

UITableView cells not updating in Swift

From Dev

UITableView in Swift - dequeueing of cells

From Java

disable the uitableview highlighting but allow the selection of individual cells

From Dev

UITextview height in UITableview swift

From Dev

Swift UITableView auto height

Related Related

  1. 1

    How to increase the height of individual options in Semantic UI?

  2. 2

    How to dynamically increase height of scrollview based on uitableview

  3. 3

    Updating A Specific Row In UITableView Without Reloading The Whole Table

  4. 4

    UItableView not reloading data swift

  5. 5

    Autofit Row Height on Both: Column with Merged Cells AND Column with Single Cells

  6. 6

    How to set height constraint of UITableView according to dynamic height cells?

  7. 7

    How to increase height for a custom UINavigationBar class in Swift

  8. 8

    How to resize the UITableView row height in Objective C

  9. 9

    UITableView dynamic cell heights - reload height for single row

  10. 10

    How to hide specific cells in a static UItableview, in swift?

  11. 11

    How to hide specific cells in a static UItableview, in swift?

  12. 12

    Pull to Refresh in Swift not Reloading UITableView

  13. 13

    Pull to Refresh in Swift not Reloading UITableView

  14. 14

    How to programmatically increase UITableView cell's height in iPhone?

  15. 15

    How to set Dynamically UITableView height in Swift?

  16. 16

    Static UITableView, make a single cell with dynamic height in Swift

  17. 17

    How to customize UITableView separator when the cells got a custom height

  18. 18

    IOS UiTableView Cells how can I make it's height adjustable

  19. 19

    How combine multiple cells into a single row in SQL?

  20. 20

    iOS/Swift: Dynamic UITableViewCell row height with embedded UITableView not working

  21. 21

    How to increase the length of cells in a single column in a table using HTML?

  22. 22

    Swift - Reorder UITableView cells

  23. 23

    Swift : Clear UITableView Cells

  24. 24

    Swift - Fading cells in UITableView

  25. 25

    UITableView cells not updating in Swift

  26. 26

    UITableView in Swift - dequeueing of cells

  27. 27

    disable the uitableview highlighting but allow the selection of individual cells

  28. 28

    UITextview height in UITableview swift

  29. 29

    Swift UITableView auto height

HotTag

Archive