Comments (6)
You are setting the delegate to an instance of UITableView Cell, not an instance of MCSwipeTableViewCell Cell. In order for this to work you have to use an instance MCSwipeTableViewCell cell not UITableView Cell. Make sense?
See below:
// In the cellForRowAtIndexPath method:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
static NSString *CellIdentifier = @"Cell";
// Create a MCSwipeTableViewCell cell instance
MCSwipeTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell)
{
cell = [[MCSwipeTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
// For the delegate callback
// Set the MCSwipeTableViewCell to delegate.
[cell setDelegate:self];
from mcswipetableviewcell.
Thanks @BeyondTheCheese for your help on this one 👍
from mcswipetableviewcell.
You are welcome!
from mcswipetableviewcell.
I am still getting this error. I copied the Sample Code and it still thinks it is passing UITableViewCell. I have tried cleaning the project, restarting Xcode, etc. I must be tired and missing something.
-
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";MCSwipeTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell) {
cell = [[MCSwipeTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}[cell setDelegate:self];
from mcswipetableviewcell.
AHhh, I am using a storyboard. I see that you need to create the tableview in code. Got it.
from mcswipetableviewcell.
For anyone who might stumble upon this again and is using Storyboards, just select the cell on Storyboards and set the Custom Class to "MCSwipeTableViewCell" like this:
from mcswipetableviewcell.
Related Issues (20)
- Swift 3 support
- Loses view when cell is recycled HOT 1
- Delegate is not weak
- Disable multi swipe gesture HOT 1
- Right swipe only - still left swipeable
- Different swipe percentages for left vs right
- Single button delete, finishes animation swipe prior to confirmation
- Cell alpha animation
- Simulate swipe? HOT 6
- Swipe menü açıldıktan sonra sabit duramaz mı?
- When I swipe on one row, another row turns the swipes color as well HOT 2
- self.array.count not working for numberOfRows in section?
- Pod time? HOT 1
- release or stop swiping cell after certain percentage swiped
- More than 2 options
- Update pod / podspec HOT 1
- Set userInteractionEnable to false when dragging ends and animation is in progress
- Feature Request: Allow default color customization for each swipe gesture
- Feature Request :- Multiple actionable buttons on swiping.
- Change renderInContext to drawViewHierarchyInRect in imageWithView
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 mcswipetableviewcell.