[英]What type of ViewController should I use in this simple iPhone app
I'm trying to make my first Xamarin iPhone app. 我正在尝试制作我的第一个Xamarin iPhone应用程序。 I have 2 views right now and i'm not sure how to be wire it up and then switch to the 2nd one.
我现在有2个视图,我不确定如何将其连接起来然后切换到第二个视图。
AuthenticationViewController
. AuthenticationViewController
。 This is a simple login/create account view. TabbedViewController
. TabbedViewController
。 A few sub views all connected by a tab controller. right now, i'm setting the root = new AuthenticationViewController
and that works fine. 现在,我正在设置
root = new AuthenticationViewController
,并且工作正常。 just not sure how to swap roots and if this is the correct way to do things. 只是不确定如何交换根以及这是否是正确的处理方式。
or should this all be done with a storyboard
(which i think is an overkill, here)? 还是应该使用
storyboard
(在这里我认为这太过分了)来完成所有这些工作?
The user should always understand where he is. 用户应始终了解他在哪里。 For that Apple suggests animations removing old content and showing new content.
为此,苹果建议动画删除旧内容并显示新内容。 One possibility is the
UINavigationController
. 一种可能性是
UINavigationController
。 You can create an empty UINavigationController
with your AuthenticationViewController
as Root. 您可以使用
AuthenticationViewController
作为Root创建一个空的UINavigationController
。 When the authentication succeeded, you can push your new ViewController (which is the TabbedViewController
) on the stack. 身份验证成功后,可以将新的ViewController(即
TabbedViewController
)推入堆栈。 If you have a log-off in your TabbedViewController
, you come back by PopViewController
. 如果您在
TabbedViewController
注销,则可以通过PopViewController
。
The other alternative is the PresentModalViewController
. 另一个选择是
PresentModalViewController
。 In the appearing controller you define the modal transitions style. 在出现的控制器中,定义模态过渡样式。 This can be anything and especially for this a FlipView-Animation is in my opinion not a bad choice.
这可以是任何东西,特别是对此我认为FlipView-Animation并不是一个坏选择。
All this exists in Xamarin like in iOS. 所有这些都存在于Xamarin中,就像iOS中一样。
StoryBoard is doing the same thing but visualizes what should happen underneath. StoryBoard正在做同样的事情,但可视化了下面应该发生的事情。 (like InterfaceBuilder for the ViewController itself).
(例如ViewController本身的InterfaceBuilder)。
At least in objective-c you can change the root view controller of the window without problems. 至少在Objective-C中,您可以毫无问题地更改窗口的根视图控制器。 The only drawback is that you cannot apply transitions doing things this way.
唯一的缺点是您不能以这种方式应用过渡服务器。 But it is totally fine to do so.
但是这样做完全没问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.