首页 > 代码库 > iOS 图片9切

iOS 图片9切

UIImageView *svRect;    UIImage *backgroundImage = [UIImage imageNamed:@"bg.png"];    backgroundImage  = [backgroundImage resizableImageWithCapInsets:UIEdgeInsetsMake(15, 15, 15,15)]; //这句就是最关键的了    svRect = [[UIImageView alloc] initWithImage:backgroundImage];    [svRect setFrame:CGRectMake(50, 50, 200, 200)];    [self.view addSubview: svRect];

防止图片放大变形

iOS 图片9切