Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Right expansion animation not working properly #37

Closed
asymptotik opened this issue Nov 13, 2014 · 5 comments
Closed

Right expansion animation not working properly #37

asymptotik opened this issue Nov 13, 2014 · 5 comments

Comments

@asymptotik
Copy link

I'm using iOS 8 and objective-c. I'm also seeing the same issue on iOS 7.1 in the simulator.... I took your MailViewController from the MailAppDemo and updated the method below. No other mods were made. What happens is when you swipe to the right, and the swipe reaches the expansion threshold, the left button animates nicely into place. However, when you swipe to the left and reach the threshold, the right button pops into place as if not animated.

-(NSArray*) swipeTableCell:(MGSwipeTableCell*) cell swipeButtonsForDirection:(MGSwipeDirection)direction
             swipeSettings:(MGSwipeSettings*) swipeSettings expansionSettings:(MGSwipeExpansionSettings*) expansionSettings
{

    swipeSettings.transition = MGSwipeTransitionBorder;
    expansionSettings.buttonIndex = 0;

    __weak MailViewController * me = self;
    MailData * mail = [me mailForIndexPath:[self.tableView indexPathForCell:cell]];

    if (direction == MGSwipeDirectionLeftToRight) {

        expansionSettings.fillOnTrigger = NO;
        expansionSettings.threshold = 2;
        return @[[MGSwipeButton buttonWithTitle:[me readButtonText:mail.read] backgroundColor:[UIColor colorWithRed:0 green:122/255.0 blue:1.0 alpha:1.0] padding:5 callback:^BOOL(MGSwipeTableCell *sender) {
            return YES;
        }]];
    }
    else {

        expansionSettings.fillOnTrigger = NO;
        expansionSettings.threshold = 2;

        MGSwipeButton * trash = [MGSwipeButton buttonWithTitle:@"Trash" backgroundColor:[UIColor colorWithRed:1.0 green:59/255.0 blue:50/255.0 alpha:1.0] padding:25 callback:^BOOL(MGSwipeTableCell *sender) {
            return YES;
        }];
        return @[trash];
    }
    return nil;   
}
@mohlman3
Copy link

@asymptotik Did you figure this out? I am seeing the same behavior in my build. Seems to be working fine in the Mail App demo. I am using Auto Layout so I'm wondering if that might have something to do with it.

@asymptotik
Copy link
Author

@mohlman3 If you replace the method I posted above in the MailAppDemo, you should see the same issue. I literally just removed code from the existing method in that demo and made the left and right buttons very similar. It seems to work with more than one button on the right, but not quite as well with just one button. The button on the left appears to be the virtually same and works as expected. I tried briefly to debug the issue, but posted here instead of spending too much time on it.

@MortimerGoro
Copy link
Owner

Fixed ;) Thanks for the info!

@mohlman3
Copy link

@MortimerGoro Works great! Thank you!

@asymptotik
Copy link
Author

Thank you so much! Works great! Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants