我在按下 UI 按钮时实现了拍照,但是当我按下按钮时,应用程序崩溃了。
这是源代码。
.h file
@interface Camera : UIViewController
<UIImagePickerControllerDelegate>
{
UIImagePickerController *mPicture;
}
@property (nonatomic, retain) UIImagePickerController *mPicture;
.m file
@implementaion Camera
@synthesize mPicture;
-(void)pictureButtonPushed
{
UIImagePickerControllerSourceType mType = UIImagePickerControllerSourceTypeCamera;
if ([UIImagePickerController isSourceTypeAvailable:mType])
{
mPicture.sourceType = mType;
[self presentModalViewController:mPicture animated:YES];
}
}
提前致谢