【发布时间】:2014-04-23 22:25:22
【问题描述】:
我正在开发一个将相机用于各种不同目的的应用。现在,当我启动应用程序时,我正在努力让一些代码运行:
UIImagePickerController *imageView = [[UIImagePickerController alloc]init];
imageView.delegate = self;
imageView.sourceType = UIImagePickerControllerSourceTypeCamera;
imageView.showsCameraControls = NO;
[self presentViewController:imageView animated:YES completion:NULL];
我需要在启动时对imageView UIView 对象执行此操作,因此当应用程序打开时,它会直接转到UIImagePickerController。这是我的应用程序的所有代码:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)applicationDidBecomeActive
{
UIImagePickerController *imageView = [[UIImagePickerController alloc]init];
imageView.delegate = self;
imageView.sourceType = UIImagePickerControllerSourceTypeCamera;
imageView.showsCameraControls = NO;
[self presentViewController:imageView animated:YES completion:NULL];
}
@end
【问题讨论】:
-
真正的问题是什么?您发布的代码在哪里?
-
我编辑了我的帖子,希望它更清楚一点。
标签: ios objective-c cocoa-touch camera