IOS截取部分图片
截取部分图片这么简单:
- (void)loadView {
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation: UIStatusBarAnimationSlide];
UIImage *image=[UIImage imageNamed:@"1.jpg"];
CGRect rect = CGRectMake(60, 80, 331, 353);//创建矩形框
UIImageView *contentView = [[UIImageView alloc] initWithFrame:rect];
contentView.image=[UIImage imageWithCGImage:CGImageCreateWithImageInRect([image CGImage], rect)];
self.view=[[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
[self.view addSubview:contentView];
[image release];
}
虽然编写代码的过程是曲折的,但是摸到很多有用的东西,都是以后要用到的。