Skip to content

Commit 3da80e1

Browse files
Update index path retrieval
1 parent e63469d commit 3da80e1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

DNSSwipeableCell/MasterViewController.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
145145

146146
- (NSInteger)numberOfButtonsInSwipeableCell:(DNSSwipeableCell *)cell
147147
{
148-
NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
148+
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:cell.center];
149149

150150
if (indexPath.row % 2 == 0) {
151151
//Even rows have 2 options
@@ -167,7 +167,7 @@ - (NSInteger)numberOfButtonsInSwipeableCell:(DNSSwipeableCell *)cell
167167

168168
- (NSString *)swipeableCell:(DNSSwipeableCell *)cell titleForButtonAtIndex:(NSInteger)index
169169
{
170-
NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
170+
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:cell.center];
171171

172172
switch (index) {
173173
case 0:
@@ -188,7 +188,7 @@ - (NSString *)swipeableCell:(DNSSwipeableCell *)cell titleForButtonAtIndex:(NSIn
188188

189189
- (UIImage *)swipeableCell:(DNSSwipeableCell *)cell imageForButtonAtIndex:(NSInteger)index
190190
{
191-
NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
191+
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:cell.center];
192192
if (indexPath.row == 0 && index == 1) {
193193
return [UIImage imageNamed:@"user"];
194194
} else {
@@ -232,7 +232,7 @@ - (UIColor *)swipeableCell:(DNSSwipeableCell *)cell tintColorForButtonAtIndex:(N
232232

233233
- (void)swipeableCell:(DNSSwipeableCell *)cell didSelectButtonAtIndex:(NSInteger)index
234234
{
235-
NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
235+
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:cell.center];
236236

237237
if (index == 0) {
238238
[self.cellsCurrentlyEditing removeObject:indexPath];
@@ -244,13 +244,13 @@ - (void)swipeableCell:(DNSSwipeableCell *)cell didSelectButtonAtIndex:(NSInteger
244244

245245
- (void)swipeableCellDidOpen:(DNSSwipeableCell *)cell
246246
{
247-
NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
247+
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:cell.center];
248248
[self.cellsCurrentlyEditing addObject:indexPath];
249249
}
250250

251251
- (void)swipeableCellDidClose:(DNSSwipeableCell *)cell
252252
{
253-
NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
253+
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:cell.center];
254254
[self.cellsCurrentlyEditing removeObject:indexPath];
255255
}
256256

0 commit comments

Comments
 (0)