- (UIImage*)imageWithImage:(UIImage*)image scaledToSize:(CGSize)newSize; { UIGraphicsBeginImageContext( newSize ); [image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)]; UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return newImage; }
Presenting view controllers on detached view controllers is discouraged
http://stackoverflow.com/questions/19890761/warning-presenting-view-controllers-on-detached-view-controllers-is-discourage
可以移动的imageview
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesMoved:touches withEvent:event]; float deltaX = [[touches anyObject] locationInView:self].x - [[touches anyObject] previousLocationInView:self].x; float deltaY = [[touches anyObject] locationInView:self].y - [[touches anyObject] previousLocationInView:self].y; self.transform = CGAffineTransformTranslate(self.transform, deltaX, deltaY); }
发邮件
NSData *imageAsData = UIImagePNGRepresentation(i); [mailController addAttachmentData:imageAsData mimeType:@"image/png" fileName:@"PicDecor.png"]; [mailController setSubject:@"My PicDecor Image"]; [self.view.window.rootViewController presentViewController:mailController animated:YES completion:nil];