Hello. I have a restaurant menu cell with a photo of the dish, price, name and button to add to the basket. After clicking on this button, it should disappear and something like [- 1pcs +] will appear
How to implement correctly: after clicking on the "put in the basket" button, first create another cell with the desired view and after pressing, change it or hide the button (button.hidden = true) and in parallel display the view with my + - buttons
Thank. If the first option is correct, please tell me which methods to use in order to change one cell to another by clicking
Thanks again
Update
Then let me ask you how to find my twist with buttons and label inside the IBAction buttons?
At the view inside which there are two buttons + - and the label assigned the tag - 1
Now implemented so
@IBAction func buttonAddToCart(sender: AnyObject) { var button: UIButton = sender as UIButton // ΠΏΠ΅ΡΠ΅Π΄Π°Π½Π½ΡΠΉ ΠΎΠ±ΡΠ΅ΠΊΡ sender ΠΏΡΠ΅ΠΎΠ±ΡΠ°Π·ΡΡ Π² ΠΠ±ΡΠ΅ΠΊΡΠΠ½ΠΎΠΏΠΊΡ var viewMoreOrLess = button.superview.superview.viewWithTag(1) // Π½Π°Ρ
ΠΎΠΆΡ Π²ΡΡΡΠΊΡ Ρ ΠΊΠ½ΠΎΠΏΠΊΠ°ΠΌΠΈ +- button.hidden = true // ΡΠΊΡΡΠ²Π°Ρ ΠΊΠ½ΠΎΠΏΠΊΡ viewMoreOrLess.hidden = false // Π΄Π΅Π»Π°Ρ Π²ΠΈΠ΄ΠΈΠΌΠΎΠΉ Π²ΡΡ Ρ +- } Works but alarming - superview.superview
Update 2
didSelectRowAtIndexPath is called when the didSelectRowAtIndexPath clicks a cell and this action expands the full description of the dish, so it is not appropriate.
I put all the actions and outlets into the custom class of my cell UITableViewCell and everything fell into place, everything worked
Thanks @tragvar great.