相关疑难解决方法(0)

如何将照片库或相机中的图像添加到我的Ipad应用程序?

我想从照片库中添加图像或使用相机添加到我的ipad应用程序中.我使用了与iphone相同的编码.但是应用程序崩溃了.我认为这不是从库添加图片到ipad应用程序的正确方法.如果有人知道请帮助我.

-(void)ctnPhotoSelection
{
    isMyCtView = YES;
    UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@""
                                                             delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil
                                                    otherButtonTitles:@"Take Photo With Camera", @"Select Photo From Library", @"Cancel", nil];
    actionSheet.actionSheetStyle = UIActionSheetStyleAutomatic;
    actionSheet.destructiveButtonIndex = 1; 
    [actionSheet showInView:self.view]; 
    [actionSheet release];
}

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if (buttonIndex == 0)
    {
        [self TakePhotoWithCamera];
    }   
    else if (buttonIndex == 1)
    {
        [self SelectPhotoFromLibrary];
    }

    else if (buttonIndex == 2)
    {
        NSLog(@"cancel");
    }
}

-(void) TakePhotoWithCamera
{
    [self startCameraPickerFromViewController:self usingDelegate:self];
}

-(void) SelectPhotoFromLibrary
{
    [self startLibraryPickerFromViewController:self usingDelegate:self]; …
Run Code Online (Sandbox Code Playgroud)

objective-c ipad ios

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

ios ×1

ipad ×1

objective-c ×1