2010-08-08 36 views
11

Có cách nào để đặt thủ công các cài đặt camera tĩnh cấp thấp như tốc độ cửa trập, khẩu độ hoặc ISO trong iOS4 trên iPhone 4 không? Tôi không nghĩ rằng nó tồn tại trong SDK chính thức nhưng có lẽ ai đó đã tìm thấy một số API riêng để cho phép điều này?Điều khiển camera cấp thấp iPhone iOS4?

Tôi thấy máy ảnh iPhone 4 của mình không thể sử dụng được vì ngay cả trong ánh sáng khá tốt, nó luôn nhấn mạnh vào tốc độ chụp chậm nhất 1/15 giây thứ hai gây ra chuyển động mờ nếu đối tượng chuyển động.

Cảm ơn!

+0

Bạn có thể làm điều này với các API riêng trong iOS 6, ít nhất. http://stackoverflow.com/a/12939981/83853 –

+0

Bạn có thể làm điều này với API riêng tư trong iOS 6, ít nhất. Hy vọng rằng họ sẽ được công khai trong bản phát hành tiếp theo. Xem câu trả lời chi tiết của tôi tại đây: http://www.stackoverflow.com/a/12939981/83853 –

+0

Câu hỏi hay. Dường như AVCaptureDevice có thể là tốt nhất bạn có thể làm, và tôi không nghĩ rằng nó cung cấp quyền truy cập vào tất cả các cài đặt mà bạn muốn kiểm soát. Điều đó nói rằng, nó có thể là một nơi tốt để bắt đầu. http://developer.apple.com/iphone/library/documentation/AVFoundation/Reference/AVCaptureDevice_Class/Reference/Reference.html#//apple_ref/doc/c_ref/AVCaptureDevice –

Trả lời

1

Không trực tiếp. Vui lòng gửi báo cáo lỗi.

Có, có thể có các API riêng tư nhưng có hạn chế sử dụng.

+0

Nộp báo cáo lỗi trên hệ điều hành hai phiên bản cũ có vẻ vô ích, đặc biệt khi nó thực sự là một yêu cầu tính năng. –

+1

Nó vẫn có liên quan, vì iOS 6 không cung cấp API này làm API công khai. –

+0

Nhưng không liên quan đến câu hỏi chính xác như nó đứng. Tôi đánh giá cao câu hỏi có thể chỉ cần chỉ định iOS 4 vì nó là 2 tuổi. Có lẽ câu hỏi cần được chỉnh sửa để tham khảo bất kỳ phiên bản iOS nào tương thích với iPhone 4? –

-2

Hãy thử điều này, tôi có thể có ích cho bạn:

@interface MyViewController() 

@property (nonatomic, retain) IBOutlet UIImageView *imageView; 

@property (nonatomic, retain) IBOutlet UIToolbar *myToolbar; 

@property (nonatomic, retain) OverlayViewController *overlayViewController; 

@property (nonatomic, retain) NSMutableArray *capturedImages; 

// toolbar buttons 

- (IBAction)photoLibraryAction:(id)sender; 

- (IBAction)cameraAction:(id)sender; 


@end 


@implementation MyViewController 
- (void)viewDidLoad 

{ 

    self.overlayViewController = 

     [[[OverlayViewController alloc] initWithNibName:@"OverlayViewController" bundle:nil] autorelease]; 



    // as a delegate we will be notified when pictures are taken and when to dismiss the image picker 

    self.overlayViewController.delegate = self; 

    self.capturedImages = [NSMutableArray array]; 


    if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) 
    { 

     // camera is not on this device, don't show the camera button 

     NSMutableArray *toolbarItems = [NSMutableArray arrayWithCapacity:self.myToolbar.items.count]; 

     [toolbarItems addObjectsFromArray:self.myToolbar.items]; 

     [toolbarItems removeObjectAtIndex:2]; 

     [self.myToolbar setItems:toolbarItems animated:NO]; 

    } 

} 


- (void)viewDidUnload 
{ 

    self.imageView = nil; 

    self.myToolbar = nil; 



    self.overlayViewController = nil; 

    self.capturedImages = nil; 

} 


- (void)dealloc 
{ 

    [_imageView release]; 

    [_myToolbar release]; 



    [_overlayViewController release]; 

    [_capturedImages release]; 



    [super dealloc]; 

} 


- (void)showImagePicker:(UIImagePickerControllerSourceType)sourceType 
{ 

    if (self.imageView.isAnimating) 

     [self.imageView stopAnimating]; 



    if (self.capturedImages.count > 0) 

     [self.capturedImages removeAllObjects]; 



    if ([UIImagePickerController isSourceTypeAvailable:sourceType]) 
    { 

     [self.overlayViewController setupImagePicker:sourceType]; 

     [self presentModalViewController:self.overlayViewController.imagePickerController animated:YES]; 

    } 

} 



- (IBAction)photoLibraryAction:(id)sender 
{ 

    [self showImagePicker:UIImagePickerControllerSourceTypePhotoLibrary]; 

} 



- (IBAction)cameraAction:(id)sender 
{ 

    [self showImagePicker:UIImagePickerControllerSourceTypeCamera]; 

} 


// as a delegate we are being told a picture was taken 

- (void)didTakePicture:(UIImage *)picture 
{ 

    [self.capturedImages addObject:picture]; 

} 


// as a delegate we are told to finished with the camera 

- (void)didFinishWithCamera 
{ 

    [self dismissModalViewControllerAnimated:YES]; 


    if ([self.capturedImages count] > 0) 
    { 

     if ([self.capturedImages count] == 1) 
     { 

      // we took a single shot 

      [self.imageView setImage:[self.capturedImages objectAtIndex:0]]; 

     } 

     else 

     { 

      // we took multiple shots, use the list of images for animation 

      self.imageView.animationImages = self.capturedImages; 



      if (self.capturedImages.count > 0) 

       // we are done with the image list until next time 

       [self.capturedImages removeAllObjects]; 



      self.imageView.animationDuration = 5.0; // show each captured photo for 5 seconds 

      self.imageView.animationRepeatCount = 0; // animate forever (show all photos) 

      [self.imageView startAnimating]; 

     } 

    } 

} 



@end 
+0

Vui lòng chỉnh sửa câu trả lời của bạn và định dạng mã để làm cho nó dễ đọc. – kleopatra

+0

Tấm áp phích hỏi về quyền truy cập ở mức độ thấp. Máy ảnh của bạn thực sự cung cấp quyền truy cập vào máy ảnh, nhưng chắc chắn nó không phải là cấp thấp. Tôi không nghĩ rằng điều này là hữu ích cho anh ta. – s1m0n

+0

@ s1m0n: - Tôi đã cố gắng giúp anh ấy, nhưng tôi cũng đã đề cập rằng "nó có thể hữu ích". tôi đã cố gắng giúp anh ta theo cấp độ của tôi tốt nhất ... – anshika

Các vấn đề liên quan