-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subclassing MGSwipeTableCell #5
Comments
Hi Philip, Changing the superclass to MGSwipeTableCell and adding the left buttons should be enough. I have a test using storyboards in the demo project but I can't reproduce the issue. Please, send me a testcase that reproduces the problem and I will debug it ;) |
+1 |
I'm fixing it - in subclassed cell added this:
|
Yeah, you should always call super methods because MGSwipeTableCell or the original UITableViewCell might have some work to do ;) Philip, does the super method call fix your problem? |
Subclass
I commented, It works fine now, In table view datasource implementation, its same like we are doing.
|
Also having difficulty with subclassing MGSwipeCell. I don't get any swipe behavior when first displaying cells, but if I scroll cells out of view and then back into view the swipe behavior works for those cells. The MGSwipeCell subclass loads its view from a nib. |
Me too, can't get it to work. I'm loading my tableview from a nib file. In my viewDidLoad: Then in tableView cellForRowAtIndexPath: The cells render fine, but I'm not able to swipe. |
I had the same issue. And also registered cells like so:
Calling
fixed the issue |
Not working for me, any chance you can share your code? |
Yup. |
Fixed. I have implemented - (id)initWithCoder:(NSCoder*)aDecoder to avoid relying only on awakeFromNib to do some internal initializations. Now it works even if you don't call [super awakeFromNib]. |
Using a subclass with a nib. Tried all the solutions mentioned above. Nothing still working. iOS 8 + iPad 2 simulator + XCode 6.1.1 |
I am having the same issue as scorpionking2k5. Subclassing with a XIB, delegate methods get called but swipe buttons dont show up at all. |
Still an issue using Swift 2, and Xcode 7. Cells do not swipe. Loading cell from XIB. |
I have exactly the same problem. Swipe fails to work when loading the cell from xib; otherwise it works fine. |
Reporting same problem as above. The way I do this is: In ViewController: tableView.register(CustomTableCell.self, forCellReuseIdentifier: "Cell")
tableView.dataSource = self
tableView.delegate = self CustomTableCell.swift: class CustomTableCell: MGSwipeTableCell {
@IBOutlet var rootView: UIView!
@IBOutlet weak var itemName: UILabel!
@IBOutlet weak var itemRating: UILabel!
@IBOutlet weak var itemSwitch: UISwitch!
required override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
commonInit()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
commonInit()
}
private func commonInit () {
Bundle.main.loadNibNamed("CustomTableCell", owner: self, options: nil)
addSubview(rootView)
rootView.frame = self.bounds
rootView.autoresizingMask = [.flexibleHeight, .flexibleWidth]
}
} |
same issue here, swiping is not working when cell is loaded from a xib file. Any solution? |
This is happening for me. I just migrated a cell from storyboard to a XIB to make it reusable and swipes don't work. I can see that it receives pan gestures OK and is setting offsets but nothing appears on the screen. I've got super calls to awakeFromNib, and initWithDecoder but nothing ever gets displayed. I've even tried calling the interval initViews later in the lifecycle to see if that helps and it doesn't. I've updated to the latest source too. Still, nothing. Did anyone crack this? |
I cracked this! It was my fault of course. In the XIB, which I had created separately from the class, I had created my layout inside the default view (which was a UIView). I should have dragged a UITableViewCell in and created my view with that. Once I did that it worked fine! |
Hi,
I am trying to use MGSwipeCell in a storyboard based app. I subclassed my table cell views for using custom IBOutlets. Now I changed the Superclass of those classes to "MGSwipeTableCell" and added two left buttons to the cell but I simple can't get the buttons to show up. Do I need to change something in my sub-classes?
Thank you for your work!
Philip
The text was updated successfully, but these errors were encountered: