I am using this open source framework in swift https://github.com/uacaps/PageMenu for my view controller.
I am using xib for the tableview cells and the tableview as shown in the demo projects.
However, when I go to connect my buttons from the tableview cell to the table view controller Xcode will not let me. I am working on the NotificationTableViewCell and NotificationTableVC files.
I have set up the project properly and can get the cell up and running as well as the project itself. However if I can't get the buttons to connect I cannot add the needed functionality.
The demo projects also have this behaviour when I cloned some from the repository. I looked through the issues and no one seemed to mention anything about connecting IBActions to the view, so I did, but I assume there is something I am missing.
I have attached screen shots to help you see my issue. I need to access the cellForRowIndexPath as well.
My xib is given the class of my table view cell which still wont allow me to interact with the tableview controller.
Okay, so I have figured out a working solution. Thanks to Gurtej Singh.
Here is the code:
1) I added this line in the cellForRowIndexPath
cell.mybutton.addTarget(self, action: "declineRequest:", forControlEvents: .TouchUpInside)
2) Now I am able to access the button if I write a function called declineRequest
Since I want to delete the cell based on its data I use this function and add the Parse query logic.
func declineRequest(sender: UIButton) {
var cell: NotificationsTableViewCell = sender.superview!.superview as! NotificationsTableViewCell
.... }