Skip to content

Commit 94f1f83

Browse files
committed
Improve performance of the -[MGSwipeTableCell imageFromView:]
1 parent 9a0f75d commit 94f1f83

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

MGSwipeTableCell/MGSwipeTableCell.m

+5-1
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,11 @@ -(UIView *) hitTest:(CGPoint)point withEvent:(UIEvent *)event
784784

785785
- (UIImage *)imageFromView:(UIView *)view {
786786
UIGraphicsBeginImageContextWithOptions(view.bounds.size, NO, [[UIScreen mainScreen] scale]);
787-
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
787+
if ([view respondsToSelector:@selector(drawViewHierarchyInRect:afterScreenUpdates:)]) {
788+
[view drawViewHierarchyInRect:view.bounds afterScreenUpdates:YES];
789+
} else {
790+
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
791+
}
788792
UIImage * image = UIGraphicsGetImageFromCurrentImageContext();
789793
UIGraphicsEndImageContext();
790794
return image;

0 commit comments

Comments
 (0)