【发布时间】:2012-07-25 09:36:26
【问题描述】:
我在点击并打开 ipad 相机时遇到了 popoverview 问题,我编写了这样的代码
-(IBAction)business_takephotobtnClicked // click the button show the popoverview
{
NSLog(@"business_takephotobtnClicked");
appdelegate.takePhoto=2;
popover = [[UIPopoverController alloc]
initWithContentViewController:imgclass];
popover.popoverContentSize = CGSizeMake(138,66);
[popover presentPopoverFromRect:popbtn_business.bounds inView:popbtn_business
permittedArrowDirections:UIPopoverArrowDirectionUp +
UIPopoverArrowDirectionLeft
animated:YES];
}
-(IBAction) takePhoto:(id)sender // to open the camera
{
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
self.contentSizeForViewInPopover=CGSizeMake(138,66);
UIPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:self.UIPicker animated:YES];
}
else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"Camera is not available" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil];
[alert show];
[alert release];
}
}
在点击按钮之前,弹出框像这样显示
点击拍照时(印楝照片按钮)。弹出窗口大小自动扩展,如 taht
但我在打开相机时也需要相同大小的弹出视图
提前致谢......
【问题讨论】: