designatednerd / dnsswipeabletablecell Goto Github PK
View Code? Open in Web Editor NEWUITableViewCell subclass to add multiple buttons to a swipe-under menu like iOS 7 Mail.
License: MIT License
UITableViewCell subclass to add multiple buttons to a swipe-under menu like iOS 7 Mail.
License: MIT License
Any idea how to prevent the swipe behavior when the user starts to scroll vertically perhaps with a slop (for diagonal scrolling)?
I believe the panGesture recognizer is interrupting the interactivePopGestureRecognizer's abililty to pop and go back. I replaced a regular UITableViewCell with it, and it went back to working.
I believe the code responsible for it is inside - (void)panThisCell:(UIPanGestureRecognizer *)recognizer
inside the UIGestureRecognizerStateChanged
case, more specifically:
if (!panningLeft) {
CGFloat constant = MAX(adjustment, 0);
if (constant == 0) {
[self resetConstraintContstantsToZero:YES notifyDelegateDidClose:NO];
} else {
self.contentViewRightConstraint.constant = constant;
}
}
Thanks,
Joe
I'm working on finding the issue, but I'm having trouble so far. I've determined that the problem is with the myContentView property. When I add a subview to UITableViewCell's contentView property, everything looks fine (but obviously swiping does not work). When I add my subview and constrain it to myContentView, it ends up looking like this.
Would it be possible to have you look into this? I'm working on it as well, but am having trouble figuring it out.
Thanks!
Would be nice to truly have the option to create the the cell from storyboard.
In issue #4 there was a request for adding support for sliding the opposite direction. I'll have to look at how complicated this is, but I think it could be a good idea.
Want to add the following features for iOS 8 style stuff:
If you begin swiping a cell, you cannot scroll. That's great.
However, if you begin scrolling you can move horizontally which will cause a cell to begin to open and be a bit jumpy in its movement. I tested the same idea against the Mail app, and Apple has it pretty well locked down so there's no horizontal cell interaction while scrolling.
Translation is often == (0,0), so it's not precise - cell sometimes not move.
The (0,0) problem is not apparent when velocityInView: is used instead of translationInView.
Current code:
CGPoint currentPoint = [recognizer translationInView:self.myContentView];
//Check what direction the swipe is moving by checking the translation
BOOL movingHorizontally = fabsf(self.panStartPoint.y) < fabsf(self.panStartPoint.x);
Fix:
CGPoint movePoint = [recognizer velocityInView:self.myContentView];
BOOL movingHorizontally = fabsf(movePoint.y) < fabsf(movePoint.x);
When adding support for swiping in either direction, I should make sure this also works in an RTL language.
Is it possible to close any other open cell as you slide a new cell open?
and have you an option for sliding the opposite way?
Setting:
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
Leaves the accessory chevron behind when the cell swipes and then when the cell returns leaves the Delete button visible behind the chevron.
When using Apple's datasource/delegate pattern, and keeping them separate, if you have a variable number of buttons per cell (maybe some cells have 1 button, some have 2, some 3), it is impossible to tell which cell you are referring to in numberOfButtonsInSwipeableCell:
without having the tableView to reference.
In the sample, it is done as so:
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:cell.center];
but if it was a true datasource, it would not need a reference to the tableView to know what index was the one being referred to.
In my code, I have a tableViewDataSource which is separate from the tableViewController (as it backs multiple different tableViewControllers), so it is currently impossible to figure out how many buttons to display depending on certain conditions of the items in my dataSource.
Otherwise, this control has been a gem, thanks so much!
Joe
Can you, please, update the podspec and submit the new pod version as well?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.