MGSwipeTableCell
MGSwipeTableCell copied to clipboard
Expandable button not in the swipe buttons
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?
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;
}
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.
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.