+ (UIImage *)resize:(UIImage *)image rect:(CGRect)rect { UIGraphicsBeginImageContext(rect.size); [image drawInRect:rect]; UIImage* resizedImage = UIGraphicsGetImageFromCurrentImageContext(); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetInterpolationQuality(context, kCGInterpolationHigh); UIGraphicsEndImageContext(); return resizedImage; }
2014年7月31日木曜日
[iOS]UIImageをリサイズする
2014年7月29日火曜日
[iOS]ディスプレイと画像の比率を求める
- (float)getScale :(CGSize)displaySize :(CGSize)imageSize { float scale = 0.0; if (imageSize.height > displaySize.height) { scale = displaySize.height / imageSize.height; } else { scale = imageSize.height / displaySize.height; } return scale; }
[iOS]メールを送信
- (void)sendMail if([MFMailComposeViewController canSendMail] == YES) { //メーラーが使用できるかどうか MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init]; [controller setSubject:@"subject"]; //題名 [controller setMessageBody:@"message" isHTML:NO]; //本文 controller.mailComposeDelegate = self; //成功、失敗時にdelegateを送る [self presentViewController:controller animated:YES completion:nil]; //ViewContrllerとして立ち上げる } } - (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error { [self dismissViewControllerAnimated:YES completion:nil]; //終了時にViewContrllerを閉じる return; }
登録:
投稿 (Atom)