iPad UIImagePicker 相机教程

发布于 2024-11-19 15:34:15 字数 152 浏览 2 评论 0原文

我在 google 上寻找完整的教程,并寻找有关使用 UIImagePicker 从相机获取图片以及从 iPad 2 上的库或相机胶卷获取图片的完整示例堆栈。

我找到了代码片段,说明只需添加 PopOverController中,但未能成功实施。

提前致谢。

I have looking for a complete tutorial on google and stack of a complete example on using the UIImagePicker to get a picture from the camera and a picture from the library or camera roll on the iPad 2.

I have found code snippets saying just add the PopOverController in, but have not been able to implement it successfully.

thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

吝吻 2024-11-26 15:34:15

对我有用。

This worked for me.

撩起发的微风 2024-11-26 15:34:15

我这样做我检测 iPhone 或 iPad 以及弹出窗口中显示的 (self.album.bounds) 只是您希望弹出窗口箭头出现在这种情况下 self.album 是触发以下操作的按钮

-(IBAction)selectPicture:(id)sender {

NSLog(@"Image is not set");

// Create image picker controller
thePicker = [[UIImagePickerController alloc] init];

// Set source to the camer roll;
thePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;

// Delegate to self
thePicker.delegate = self;

//Allow editing of image NO
thePicker.allowsEditing = NO;


if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {


[self presentModalViewController:thePicker animated:YES];

}

else{

    popover = [[UIPopoverController alloc]initWithContentViewController:thePicker];
    [popover presentPopoverFromRect:self.album.bounds inView:self.album permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
    popover = popover;

}

}

I do it like this I detect if iPhone or iPad and in the popover where it says (self.album.bounds) is just were you want the popover arrow to appear in this case self.album is the button that fires the below action

-(IBAction)selectPicture:(id)sender {

NSLog(@"Image is not set");

// Create image picker controller
thePicker = [[UIImagePickerController alloc] init];

// Set source to the camer roll;
thePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;

// Delegate to self
thePicker.delegate = self;

//Allow editing of image NO
thePicker.allowsEditing = NO;


if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {


[self presentModalViewController:thePicker animated:YES];

}

else{

    popover = [[UIPopoverController alloc]initWithContentViewController:thePicker];
    [popover presentPopoverFromRect:self.album.bounds inView:self.album permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
    popover = popover;

}

}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文