我想从照片库中添加图像或使用相机添加到我的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)