类似安卓的点9图片,气泡图片调成自己需要的

例如一张图片

balloon_file_right_blue@2x.png

- (void)viewDidLoad {

    [super viewDidLoad];

    self.view.backgroundColor = [UIColor lightGrayColor];

    

    UIImageView *ImgVW = [[UIImageView alloc]initWithFrame:CGRectMake(20, 64, self.view.frame.size.width-40, 250)];

    UIImage *myimage = [UIImage imageNamed:@"[email protected]"];

    

    CGFloat top = 20; // 顶端盖高度

    CGFloat bottom = 20; // 底端盖高度

    CGFloat left = 10; // 左端盖宽度

    CGFloat right = 10; // 右端盖宽度

    


    

    UIEdgeInsets insets = UIEdgeInsetsMake(top, left, bottom, right);

    

    // 指定为拉伸模式,伸缩后重新赋值

    

    myimage = [myimage resizableImageWithCapInsets:insets resizingMode:UIImageResizingModeStretch];

//    myimage = [myimage resizableImageWithCapInsets:insets];

    ImgVW.image = myimage;

    [self.view addSubview:ImgVW];

    

}

39E40DE5FF1727C9FD58EE46D6456F20.png


你可能感兴趣的:(类似安卓的点9图片,气泡图片调成自己需要的)