2013-11-26 9 views
6

Ich versuche Bibliothek Schaltfläche in der Kamera anzuzeigen (UIImagePickerController). Hier ist mein Code:UIImagePickerController einfache Möglichkeit, Bibliothek Schaltfläche in der Kamera zu zeigen

- (void)takePhoto{ 
    _imagePicker = [[UIImagePickerController alloc] init]; 
    [_imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera]; 
    [_imagePicker setDelegate:self]; 
    _imagePicker.allowsEditing = YES; 
    CGRect frame = self.view.frame; 
    int y = frame.size.height; 
    int x = frame.size.width; 

    UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(x-100, y-50-1, 100, 30)]; 
    [button setTitle:@"Library" forState:UIControlStateNormal]; 
    [button setBackgroundColor:[UIColor clearColor]]; 
    [button addTarget:self action:@selector(gotoLibrary:) forControlEvents:UIControlEventTouchUpInside]; 

    [_imagePicker.view addSubview:button]; 

    [self presentViewController:_imagePicker animated:NO completion:nil]; 


} 
-(IBAction)gotoLibrary:(id)sender 
{ 
    UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; 
    [imagePicker.view setFrame:CGRectMake(0, 80, 450, 350)]; 
    [imagePicker setSourceType:UIImagePickerControllerSourceTypeSavedPhotosAlbum]; 
    imagePicker.allowsEditing = YES; 
    [imagePicker setDelegate:self]; 

    [_imagePicker presentViewController:imagePicker animated:YES completion:nil]; 
} 

Problem ist in Bildern, wenn ich versuche, Foto zu machen. Wie kann ich eine Bibliotheksschaltfläche ausblenden, wenn ich Fotos mache? How it looks like

And problem as this

+0

Hallo, waren Sie in der Lage, das zu lösen? –

+0

Beitritt der Frage – Danpe

Antwort

0

Der arme Mann Weg, um dieses Problem zu beheben, wäre das Etikett an der Spitze zu positionieren, zentrierte, so dass es nicht mit der Fototaste in Konflikt;)

Nicht die größte Lösung - aber es ist super schnell

Verwandte Themen