0
我有一個應用程序,我需要拍一張照片,然後通過繪製它來製作png圖層。我的png層絕對正確,並具有橫向維度。如何在橫向模式下拍攝照片[iOS8]?
但是當我上傳拍攝的照片時,它具有縱向尺寸。
- (void)takePhoto {
AVCaptureConnection *videoConnection = nil;
for (AVCaptureConnection *connection in StillImageOutput.connections) {
for (AVCaptureInputPort *port in [connection inputPorts]) {
if ([[port mediaType] isEqual:AVMediaTypeVideo]) {
videoConnection = connection;
break;
}
}
}
[StillImageOutput captureStillImageAsynchronouslyFromConnection:videoConnection completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) {
if (imageDataSampleBuffer != NULL) {
NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer];
UIImage *image = [UIImage imageWithData:imageData];
UIImage *ipadImage = [self imageRotatedByDegrees:image deg:0];
NSLog(@"image orientation: %ld", (long)image.imageOrientation);
NSLog(@"image width: %f , height: %f", image.size.width, image.size.height);
captured.image = ipadImage;
謝謝你的幫忙!
考慮接受有用的答案。 要接受答案,請點擊最佳答案旁邊的空白複選標記,這樣做會增加您的聲望並提供更多功能,請參閱[聲譽常見問題](http://stackoverflow.com/faq#reputation)請參閱[這個頁面](http://meta.stackoverflow.com/questions/5234/how-does-accepting-an-answer-work)瞭解更多細節。也請考慮回去並接受過去的答案,這樣做會增加你的聲望並允許更多功能,請參閱[聲譽常見問題](http://stackoverflow.com/faq#reputation) – zaph