iPhone - 在 UIImagePickerController 上显示模式视图

发布于 2024-12-09 20:14:27 字数 936 浏览 1 评论 0原文

我有一个 UIImagePickerController,在加载时,我想在 modalView 中显示免责声明。

- (void) viewDidLoad 
{
    self.picker = [[UIImagePickerController alloc] init];
    self.picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    self.picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
    self.picker.delegate = self;

    [self presentModalViewController:self.picker animated:NO];
    [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];

    DisclaimerController* disclaimer = [[DisclaimerController alloc] init];  // Loads the Xib inside the init method
    UINavigationController* controller = [[UINavigationController alloc] initWithRootViewController:disclaimer];
    [self.navigationController presentModalViewController:controller animated:YES];
}

但它没有显示出来。

而且我不想在免责声明显示或稍后显示时关闭选择器,因为有些处理需要一些时间,并且用户阅读免责声明的时间会阻止他在关闭免责声明后等待太长时间。

I have a UIImagePickerController, and while it's loading, I want to display a disclaimer in a modalView.

- (void) viewDidLoad 
{
    self.picker = [[UIImagePickerController alloc] init];
    self.picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    self.picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
    self.picker.delegate = self;

    [self presentModalViewController:self.picker animated:NO];
    [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];

    DisclaimerController* disclaimer = [[DisclaimerController alloc] init];  // Loads the Xib inside the init method
    UINavigationController* controller = [[UINavigationController alloc] initWithRootViewController:disclaimer];
    [self.navigationController presentModalViewController:controller animated:YES];
}

But it doesn't shows up.

And I don't want to dismiss the picker while the disclaimer is showing or show it later, because there are some treatments that takes some time and the time the user reads the disclaimer would prevent him to wait too long after closing the disclaimer.

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

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

发布评论

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

评论(1

一萌ing 2024-12-16 20:14:27

我会使用 AlertView 来解决它。

但如果您更喜欢使用您的方法,也许这会起作用

尝试这个:

- (void) showModalDisclaimer {
        DisclaimerController* disclaimer = [[DisclaimerController alloc] init];  
        // Loads the Xib inside the init method
        UINavigationController* controller = [[UINavigationController alloc] 
                                          initWithRootViewController:disclaimer];
        [self.picker presentModalViewController:controller animated:YES]; 
        // notice self.picker
}

- (void) viewDidLoad 
{
    self.picker = [[UIImagePickerController alloc] init];
    self.picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    self.picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
    self.picker.delegate = self;

    [self presentModalViewController:self.picker animated:NO];
    [[UIApplication sharedApplication] setStatusBarHidden:NO   
                       withAnimation:UIStatusBarAnimationNone];
    [self performSelector:@selector(showModalDisclaimer) withObject:nil afterDelay:0.1];
}

I would solve it using an AlertView.

But if you prefer using your method maybe this will do the trick

Try this:

- (void) showModalDisclaimer {
        DisclaimerController* disclaimer = [[DisclaimerController alloc] init];  
        // Loads the Xib inside the init method
        UINavigationController* controller = [[UINavigationController alloc] 
                                          initWithRootViewController:disclaimer];
        [self.picker presentModalViewController:controller animated:YES]; 
        // notice self.picker
}

- (void) viewDidLoad 
{
    self.picker = [[UIImagePickerController alloc] init];
    self.picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    self.picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
    self.picker.delegate = self;

    [self presentModalViewController:self.picker animated:NO];
    [[UIApplication sharedApplication] setStatusBarHidden:NO   
                       withAnimation:UIStatusBarAnimationNone];
    [self performSelector:@selector(showModalDisclaimer) withObject:nil afterDelay:0.1];
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文