0

Итак, у меня есть UIImagePickerControler. Я хочу, чтобы он был полноэкранным, и я хочу иметь контроллер навигации, который я могу полностью настроить. Это возможно? Я попытался сделать свой собственный UINavigationController и нажал UIImagePickerController с скрытой навигационной панелью и полноэкранным режимом камеры, но, очевидно, Apple этого не допускает.Можно ли создать полностью настраиваемый UIImagePickerController?

Любая помощь будет оценена по достоинству.

+0

Вероятно, дубликат этого - http://stackoverflow.com/questions/15865368/how-to-create-a-custom-uiimagepickercontroller-with -full-screen-images-ios – taylorcressy

+0

Да, это возможно. Получите медиа-список с помощью 'AssetsLibrary.framework' и покажите их в' UICollectionView'. Для отображения камеры используйте 'AVFoundation.framework' –

ответ

0

Да, вот вы один я сделал:

#pragma mark - Custom ImagePicker 
    -(void) createCustonImagePicker 
    { 

self.imagePickerController = [[UIImagePickerController alloc] init]; 
self.imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera; 
self.imagePickerController.showsCameraControls = NO; 



CGFloat height = [UIScreen mainScreen].bounds.size.height; 
UIView *newView = [[UIView alloc] initWithFrame:CGRectMake(0, 0,  self.imagePickerController.view.bounds.size.width, self.imagePickerController.view.bounds.size.height)]; 
UIView *downBack; 

if (height == 480) { 
    // Configure to iPhone 4 -4s 
    UIView *upBack = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 35)]; 
    upBack.backgroundColor = [UIColor blackColor]; 
    [newView addSubview:upBack]; 
    downBack = [[UIView alloc] initWithFrame:CGRectMake(0, 355, 320, 125)]; 
    downBack.backgroundColor = [UIColor blackColor]; 
    [newView addSubview:downBack]; 

    UIButton *flashButton = [[ UIButton alloc] initWithFrame:CGRectMake(15, 7, 120, 20)]; 
    // Configure your own flash button 
    [upBack addSubview:flashButton]; 

    UIImageView *icono = [[UIImageView alloc] initWithFrame:CGRectMake(5, 12, 22, 22)]; 
    icono.image = [UIImage imageNamed:@"dotred"]; 
    [downBack addSubview:icono]; 

    UILabel *text = [[UILabel alloc] initWithFrame:CGRectMake(40, 2.5, 280, 40)]; 
    text.font = // Here your font; 
    text.textColor = [UIColor whiteColor]; 
    text.text = NSLocalizedString(@"Here is and example to see", nil); 
    text.numberOfLines = 2; 
    [downBack addSubview:text]; 

    UIButton *cancel = [[UIButton alloc] initWithFrame:CGRectMake(230, 7, 70, 20)]; 
    // cancel.titleLabel.font = MAIN_FONT; 
    cancel.titleLabel.textAlignment = NSTextAlignmentRight; 
    cancel.titleLabel.textColor = [UIColor whiteColor]; 
    [cancel setTitle:NSLocalizedString(@"Cancel", nil) forState:UIControlStateNormal]; 
    [cancel addTarget:self action:@selector(cancelButton:) forControlEvents:UIControlEventTouchUpInside]; 
    [newView addSubview:cancel]; 


} else { 
    UIView *upBack = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 80)]; 
    upBack.backgroundColor = [UIColor blackColor]; 
    [newView addSubview:upBack]; 
    downBack = [[UIView alloc] initWithFrame:CGRectMake(0, 400, 320, 168)]; 
    downBack.backgroundColor = [UIColor blackColor]; 
    [newView addSubview:downBack]; 

    UIButton *flashButton = [[ UIButton alloc] initWithFrame:CGRectMake(15, 27, 120, 20)]; 

    [upBack addSubview:flashButton]; 

    UIImageView *icono = [[UIImageView alloc] initWithFrame:CGRectMake(10, 22, 22, 22)]; 
    icono.image = [UIImage imageNamed:@"dotred"]; 
    [downBack addSubview:icono]; 

    UILabel *text = [[UILabel alloc] initWithFrame:CGRectMake(40, 12.5, 280, 40)]; 
    text.font =You font; 
    text.textColor = [UIColor whiteColor]; 
    text.text = NSLocalizedString(@"Example the\ntext, nil); 
    text.numberOfLines = 2; 
    [downBack addSubview:text]; 

    UIButton *cancel = [[UIButton alloc] initWithFrame:CGRectMake(230, 27, 70, 20)]; 
    // cancel.titleLabel.font = MAIN_FONT; 
    cancel.titleLabel.textColor = [UIColor whiteColor]; 
      cancel.titleLabel.textAlignment = NSTextAlignmentRight; 
    [cancel setTitle:NSLocalizedString(@"Cancel", nil) forState:UIControlStateNormal]; 
    [cancel addTarget:self action:@selector(cancelButton:) forControlEvents:UIControlEventTouchUpInside]; 
    [newView addSubview:cancel]; 
} 


    self.takePhotoButton = [[UIButton alloc] initWithFrame:CGRectMake(123, height -80, 73, 73)]; 
    [self.takePhotoButton setImage:[UIImage imageNamed:@"cambuttonred"] forState:UIControlStateNormal]; 
    [self.takePhotoButton setImage:[UIImage imageNamed:@"cambuttonblack"] forState:UIControlStateHighlighted]; 
    [newView addSubview:self.takePhotoButton]; 
    [self.takePhotoButton addTarget:self action:@selector(takeTakMainPhoto) forControlEvents:UIControlEventTouchUpInside]; 
    self.takePhotoButton.hidden = YES; 

[newView addSubview:self.isReadyLabel]; 
self.imagePickerController.cameraOverlayView = newView; 
if (height == 480) { 
self.imagePickerController.cameraViewTransform = CGAffineTransformMake(1.0, 0.0, 0.0,1.0, 0.0, 35); 
} else { 
self.imagePickerController.cameraViewTransform = CGAffineTransformMake(1.0, 0.0, 0.0,1.0, 0.0, 80); 
} 

self.imagePickerController.delegate = self; 



} 
Смежные вопросы