简体   繁体   English

模态视图滑出屏幕

[英]ModalView slide off screen

I am creating a user registration functionality in my application and needed some direction in how to implement it.我正在我的应用程序中创建一个用户注册功能,并且需要一些指导来实现它。 Currently, my main screen only has a sign up button.目前,我的主屏幕只有一个注册按钮。 When the user clicks the sign up button, a modalview slides up from the bottom and presents the user with the required textfields for registration.当用户单击注册按钮时,模态视图会从底部向上滑动,并向用户显示注册所需的文本字段。 The user fills out the form and clicks the submit button on the top right of the nav bar ( I added a nav bar to the modalview).用户填写表单并单击导航栏右上角的提交按钮(我在 modalview 中添加了一个导航栏)。 When the user clicks the submit button, I would like for the modalview to "disappear" and display a activity indicator while validation takes place.当用户单击提交按钮时,我希望模态视图“消失”并在进行验证时显示活动指示器。 If a user successfully registers, the activity indicator should disappear and the new screen slide in from the right.如果用户成功注册,活动指示器应该会消失,并且新屏幕会从右侧滑入。 If the submission failed for any reason, the modal view should "re-appear" with the information the user entered.如果由于任何原因提交失败,模式视图应该“重新出现”用户输入的信息。

Right now my problem is hiding the modalview during validation and sliding in the new screen on successful registration.现在我的问题是在验证期间隐藏模态视图并在成功注册时在新屏幕中滑动。 What are some approaches to this?有哪些方法可以解决这个问题?

Thanks much in advance!提前非常感谢!

Here is the method that creates the modalview:这是创建模态视图的方法:

- (void)getSignUpView:(id)sender
{

    SignUpViewController *signUpViewcontroller = [[SignUpViewController alloc]
                                                  initWithStyle:UITableViewStyleGrouped];

    UINavigationController *navigationController = [[UINavigationController     alloc] initWithRootViewController:signUpViewcontroller];
    [self presentModalViewController:navigationController animated:YES];

    [signUpViewcontroller release];

}

I would suggest you add the activity indicator as another view to your navigation controller and set the animation to NO.我建议您将活动指示器作为另一个视图添加到您的导航 controller 并将 animation 设置为 NO。 If the validation is successful pop out this view and add the new controller with animation set to YES.如果验证成功,弹出此视图并添加新的 controller 并将 animation 设置为 YES。

If unsucessfull then pop till the root view controller.如果不成功,则弹出到根视图 controller。 Your piece of code suggests you are aware of the method calls to do so.您的代码表明您知道这样做的方法调用。 Let me know if you need some additional code.如果您需要一些额外的代码,请告诉我。

Take Navigation controller to appear in modal view, and inside navigation controller, there would be view controller, so that you do not need to take navigation bar in modal view.以 Navigation controller 出现在模态视图中,在导航 controller 中,将出现视图 controller,因此您不需要在视图中获取导航栏。

[self presentModalViewController:navController animated:YES];

where navController is UINavigationController, this way it would be easy if user clicks on top right corner button, wait for loading indicator or registration, Do not dismiss modal view, and if registration success, you can push new view controller into navigation controller.其中navController为UINavigationController,这样用户点击右上角按钮,等待加载指示器或注册,不要关闭模态视图,如果注册成功,您可以将新视图controller推入导航Z594C103F2F2F6E04C。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM