MGSwipeTableCell icon indicating copy to clipboard operation
MGSwipeTableCell copied to clipboard

Expandable button not in the swipe buttons

Open TfADrama opened this issue 8 years ago • 3 comments

When i swipe a cell i want to only show the NOT EXPANDABLE buttons and still have the possibility to expand and show the expandable button when swiping all the way.

Resuming, how i only show the expandable button when expanding the cell? Is this possible or i need to find another framework?

TfADrama avatar Aug 23 '16 13:08 TfADrama

Hello,

There is not a builtin property to achieve that, but you can try something like this using this delegate method

-(void) swipeTableCell:(MGSwipeTableCell*) cell didChangeSwipeState:(MGSwipeState) state gestureIsActive:(BOOL) gestureIsActive
{
    UIView * btn = [cell.rightButtons objectAtIndex:0]; //use you preferred index here
    btn.hidden = state != MGSwipeStateExpandingRightToLeft;
}

MortimerGoro avatar Aug 23 '16 17:08 MortimerGoro

Hi Imanol

Thank you for your reply but I as a beginner and who doesn’t understand Object C, only a bit of Swift. Could you please suggest a snippet in Swift.

Regards Alan

On 23 Aug 2016, at 18:20, Imanol Fernandez [email protected] wrote:

Hello,

There is not a builtin property to achieve that, but you can try something like this using this delegate method

-(void) swipeTableCell:(MGSwipeTableCell*) cell didChangeSwipeState:(MGSwipeState) state gestureIsActive:(BOOL) gestureIsActive { UIView * btn = [cell.rightButtons objectAtIndex:0]; //use you preferred index here btn.hidden = state != MGSwipeStateExpandingRightToLeft; }

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/MortimerGoro/MGSwipeTableCell/issues/223#issuecomment-241807376, or mute the thread https://github.com/notifications/unsubscribe-auth/ANmdc52DPk8wc3mjNPbQiZMQl80Wthf-ks5qiyvKgaJpZM4Jq8tH.

Mac-Man-APH avatar Aug 23 '16 19:08 Mac-Man-APH

Hi MortimerGoro and Mac-Man-APH, Thanks for your reply. Th answer from Mortimer in swift:

 func swipeTableCell(cell: MGSwipeTableCell!, didChangeSwipeState state: MGSwipeState, gestureIsActive: Bool) {
          var btn = cell.rightButtons[0]
          //use you preferred index here
          btn.hidden = state != .ExpandingRightToLeft
      }

But using this (at least in swift), it gives me the following error in the last line:

Cannot assign to property: 'btn' is immutable.

TfADrama avatar Aug 24 '16 08:08 TfADrama