Skip to content

Commit

Permalink
fix(ios): fix view background image frame bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwcg authored and hippy-actions[bot] committed Oct 30, 2023
1 parent bad8e37 commit ca3807a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions renderer/native/ios/renderer/component/view/HippyView.m
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,10 @@ - (BOOL)getLayerContentForColor:(UIColor *)color completionBlock:(void (^)(UIIma
CGSize imageSize = decodedImage.size;
CGSize targetSize = UIEdgeInsetsInsetRect(theFrame, [self bordersAsInsets]).size;
CGSize drawSize = makeSizeConstrainWithType(imageSize, targetSize, backgroundSize);
[decodedImage drawInRect:CGRectMake(borderInsets.left + backgroundPositionX,
borderInsets.top + backgroundPositionY,
CGPoint originOffset = CGPointMake((targetSize.width - drawSize.width) / 2.0,
(targetSize.height - drawSize.height) / 2.0);
[decodedImage drawInRect:CGRectMake(borderInsets.left + backgroundPositionX + originOffset.x,
borderInsets.top + backgroundPositionY + originOffset.y,
drawSize.width,
drawSize.height)];
//draw border
Expand Down

0 comments on commit ca3807a

Please sign in to comment.