Closed ranudhurandar closed 5 years ago
I want to hide a view present in ExampleCardCell according to the tapgesture on particular cell. I have tried using didTapCard() method but failed so implemented:
func cardForItemAt(verticalCardSwiperView: VerticalCardSwiperView, cardForItemAt index: Int) -> CardCell {
if let cardCell = verticalCardSwiperView.dequeueReusableCell(withReuseIdentifier: "ExampleCell", for: index) as? ExampleCardCell {
let contact = contactsDemoData[index]
cardCell.setRandomBackgroundColor()
cardCell.nameLbl.text = "Name: " + contact.name
cardCell.ageLbl.text = "Age: \(contact.age ?? 0)"
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.myviewTapped(sender:)))
tapGesture.delegate = self
cardCell.mainView.addGestureRecognizer(tapGesture)
return cardCell
}
return CardCell()
}
@objc func myviewTapped(sender: UITapGestureRecognizer){
let tag = self.cardSwiper.focussedCardIndex
let cell = ExampleCardCell()
if cell.bottomView.isHidden {
//add code
}
}
I want to access cell.bottomView for selected index.
Hi,
I updated your title to better reflect your question I think?
So if I understand correctly, you want to hide a view inside of a CardCell
once the user taps on that cell, but the tap isn't being received?
That's true.
On Wed, 10 Jul, 2019, 4:42 PM Joni Van Roost, notifications@github.com wrote:
Hi, I updated your title to better reflect your question I think? So if I understand correctly, you want to hide a view inside of a CardCell once the user taps on that cell, but the tap isn't being received?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JoniVR/VerticalCardSwiper/issues/54?email_source=notifications&email_token=AGOMZKBZ4TFCX4PVY4KLBCLP6W7YVA5CNFSM4H6K6QL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZTEDQQ#issuecomment-510017986, or mute the thread https://github.com/notifications/unsubscribe-auth/AGOMZKE4IKF6ZBQ4ER5RQODP6W7YVANCNFSM4H6K6QLQ .
Use
handleTap(sender: UITapGestureRecognizer)
and then usesender.location(in: <ViewYouWantToDetect>)
see this.
After reading this again I realised that this suggestion was wrong as handleTap
is only used internally and not exposed to the api.
You should still be able to use didTapCard
for what you're trying to do though (if it's only detecting if a specific cell was tapped). Make sure you set the VerticalCardSwiperDelegate
though, otherwise it won't work, like in the example code:
cardSwiper.delegate = self
I'm sorry for the confusion.
New Issue Checklist
Question