Skip to content

Instantly share code, notes, and snippets.

@bnickel
Created August 26, 2016 18:48
Show Gist options
  • Save bnickel/2c8d8651c94a7d6ba46b12ce2d5df537 to your computer and use it in GitHub Desktop.
Save bnickel/2c8d8651c94a7d6ba46b12ce2d5df537 to your computer and use it in GitHub Desktop.
@interface UIMenuController (Swizzle)
@end
@implementation UIMenuController (Swizzle)
+ (void)load
{
[self jr_swizzleMethod:@selector(setTargetRect:inView:) withMethod:@selector(SE_setTargetRect:inView:) error:NULL];
}
- (void)SE_setTargetRect:(CGRect)targetRect inView:(UIView *)targetView
{
SEMenuCell *cell = SEAPIDynamicCast(targetView, SEMenuCell);
if (cell != nil) {
targetRect.size.width = cell.supposedWidth;
}
[self SE_setTargetRect:targetRect inView:targetView];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment