iOS 图片 的 聊天气泡显示 Objective-C
- (void)viewDidLoad { [super viewDidLoad]; UIImageView *ImageView01 = [[UIImageView alloc] init]; [ImageView01 setFrame:CGRectMake(90, 190, 120, 180)]; [ImageView01 setImage:[UIImage imageNamed:@"style.jpg"]]; [self.view addSubview:ImageView01]; UIImage *bubble = [UIImage imageNamed:@"icon_chat_right_bg"]; UIImageView *ImageView = [[UIImageView alloc] init]; [ImageView setFrame:ImageView01.frame]; [ImageView setImage:[bubble stretchableImageWithLeftCapWidth:15 topCapHeight:15]]; CALayer *layer = ImageView.layer; layer.frame = (CGRect){{0,0},ImageView.layer.frame.size}; ImageView01.layer.mask = layer; [ImageView01 setNeedsDisplay];
如何实现聊天软件的图片显示的剪裁后的气泡呢
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步