UIImage *contentBgImagebubble = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:fromSelf?@"bubbleSelf":@"bubble" ofType:@"png"]];
UIImage * newBgImage =[contentBgImagebubble stretchableImageWithLeftCapWidth:21 topCapHeight:14] ;
UIImageView * contentBgImage=[[UIImageView alloc] initWithImage:newBgImage];
contentBgImage.frame=CGRectMake(10,10,200,100);
UIImage *contentBgImagebubble = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:fromSelf?@"bubbleSelf":@"bubble" ofType:@"png"]];
UIImage * newBgImage =[contentBgImagebubble stretchableImageWithLeftCapWidth:21 topCapHeight:14] ;
UIImageView * contentBgImage=[[UIImageView alloc] initWithImage:newBgImage];
contentBgImage.frame=CGRectMake(10,10,200,100);
UIImage * newBgImage =[contentBgImagebubble stretchableImageWithLeftCapWidth:21 topCapHeight:14] ;
UIImageView * contentBgImage=[[UIImageView alloc] initWithImage:newBgImage];
contentBgImage.frame=CGRectMake(10,10,200,100);
UIImage *contentBgImagebubble = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:fromSelf?@"bubbleSelf":@"bubble" ofType:@"png"]];
UIImage * newBgImage =[contentBgImagebubble stretchableImageWithLeftCapWidth:21 topCapHeight:14] ;
UIImageView * contentBgImage=[[UIImageView alloc] initWithImage:newBgImage];
contentBgImage.frame=CGRectMake(10,10,200,100);
本文介绍如何在 iOS 开发中使用 Objective-C 加载并设置可拉伸的 UI 图片。通过 UIImage 和 UIImageView 实现特定尺寸的图片拉伸效果,适用于聊天气泡等界面元素。

1619

被折叠的 条评论
为什么被折叠?



