Here are the answers:
No, it's not. But I would say more precise answer if you could please show the design of the cell that will not have the button "show details". But basically, I would say that the rule is "if the top part is the same then you can use the same design for both cells". Since what you will do is just hide the bottom part of the cell. It will be hidden due to the smaller height of the cell. BUT: taking consideration that you want to make it lite you may don't want to have a redundant bottom part of the cell which is hidden from doing nothing. So ideally is to have 2 separate cells but answering your question it is not necessary.
Here you have 2 questions: how to check the click + how to expand. I'll explain 1 by 1.
2.1. How to check the click: create a delegate in the cell class that will tell your view controller that the button "show details" was tapped and then expand the cell in the view controller.
2.2. Simply use heightForCellAtIndexPath
to regulate the height of the cell. If it's expanded then make it higher if not make it shorter. But main point here is that when the delegate method gets called you need to call tableView.reloadRows(at:)
where you need to reload the cell with animation and it will expand the cell with a nice animation. Btw I prefer using .fade
animation.
- I think I answered this one above but please let me know if it's not clear yet.
Hope it helps.