使用切换控制器切换 2 个视图
这是主视图,我想切换两个单独的视图;为 ON 状态和 OFF 状态。
代码会是什么样子?
This is the main view and I'd like to toggle two separated views; for ON state and for OFF state.
How the code would look like?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
执行以下操作
确保“y”原点 viewController1 和 viewController2 位于分段控件下方,以便分段控件不会隐藏。
Do the following
Make sure that the 'y' origin viewController1 and viewController2 are below the Segmented Control so that the segmented control is not hidden.
您可以在xib中获取两个视图,并在视图加载时将两个视图添加到主视图中,并为您不想显示的视图设置隐藏属性,然后为开关控制事件设置隐藏属性TRUE或FALSE。
you can take two view in xib and add both view in main view at view did load and set the property hidden for one which you don't want to show, and then set hidden property TRUE or FALSE for switch control event on off.
尝试以下操作
Try the following