Comments (19)
Still an issue using Swift 2, and Xcode 7. Cells do not swipe. Loading cell from XIB.
from mgswipetablecell.
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 ;)
from mgswipetablecell.
+1
I'm create custom cell with subclass and this don't work (@interface CheckInCell : MGSwipeTableCell).
Work only with original cell.
from mgswipetablecell.
I'm fixing it - in subclassed cell added this:
- (void)awakeFromNib
{
[super awakeFromNib];
}
from mgswipetablecell.
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?
from mgswipetablecell.
Subclass MGSwipeTableCell
instead of UITableViewCell
I've resolved the issue by implementing
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
//add your cell objects here
}
return self;
}
I commented,
//- (void)awakeFromNib {
// [super awakeFromNib];
//}
It works fine now,
In table view datasource implementation, its same like we are doing.
static NSString *cellIdentifier = @"cellIdentifier";
Custom *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if(cell == nil) {
cell = [[Custom alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
}
from mgswipetablecell.
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.
from mgswipetablecell.
Me too, can't get it to work. I'm loading my tableview from a nib file.
In my viewDidLoad:
[self.tableView registerNib:[UINib nibWithNibName:@"CustomTableViewCell" bundle:nil] forCellReuseIdentifier:@"CustomReuseIdentifier"];
Then in tableView cellForRowAtIndexPath:
MGSwipeTableCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CustomReuseIdentifier" forIndexPath:indexPath];
The cells render fine, but I'm not able to swipe.
from mgswipetablecell.
I had the same issue. And also registered cells like so:
[self.tableView registerNib:[UINib nibWithNibName:userCellIdentifier bundle:nil]
forCellReuseIdentifier:userCellIdentifier];
Calling
[super awakeFromNib];
fixed the issue
from mgswipetablecell.
Not working for me, any chance you can share your code?
from mgswipetablecell.
Yup.
-(void)awakeFromNib { [super awakeFromNib]; } in the MGSwipeTableCell subclass works for me.
from mgswipetablecell.
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].
from mgswipetablecell.
Using a subclass with a nib.
Tried using with and without delegate.
Delegate methods get called but nothing happening still. Failing to get any swipe action at all.
Tried all the solutions mentioned above. Nothing still working.
iOS 8 + iPad 2 simulator + XCode 6.1.1
from mgswipetablecell.
I am having the same issue as scorpionking2k5.
Subclassing with a XIB, delegate methods get called but swipe buttons dont show up at all.
from mgswipetablecell.
I have exactly the same problem. Swipe fails to work when loading the cell from xib; otherwise it works fine.
from mgswipetablecell.
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]
}
}
from mgswipetablecell.
same issue here, swiping is not working when cell is loaded from a xib file. Any solution?
from mgswipetablecell.
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?
from mgswipetablecell.
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!
from mgswipetablecell.
Related Issues (20)
- Crashes at MGSwipeTableCell.m line 926 -[MGSwipeTableCell hideSwipeOverlayIfNeeded] HOT 7
- Round Corner HOT 1
- Gesture conflicts with 2-finger pan multi selection gesture
- SPM support HOT 1
- iPhone X and on: When table view is on split view controller, right side button are cut
- MGSwipeTableCellDelegate not working
- how to disable swipe vertical scrolling
- Multiple selections in ios13 UI not refresh
- Does anyone occur white cells by using 1.6.11? HOT 6
- Swipe not working with Magic Trackpad 2
- Problem when using shadow HOT 1
- Hang on swipe in iOS 14.4 HOT 6
- Add double confirm feature like wechat delete conversation check
- Unable to add MGSwipeTableCell via Swift Package HOT 2
- occasionally i see crash in my app.
- Tag 1.6.11 does not include Swift Package Manager support. HOT 1
- Visual glitch/flash on refreshContentView() while cell is swiped open
- still looks good
- .
- Privacy Manifest
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mgswipetablecell.