模仿iOS通知视图
我正在尝试模仿 iOS 5 的通知视图(当您向下滑动时会出现视图),以便在我的视图中向左滑动。我通过将 hubview 添加为子视图并在滑动时更改视图的原点,为单个视图控制器创建了一个模拟。但通过这种方法,我必须将其添加到我在应用程序中实现的每个视图中。我想将其作为类别添加到 UIViewController
中。我现在不知道如何继续。
I am trying to mimic iOS 5's notification view (when you swipe down the view appears) for hub with a left swipe in my view. I created a mimic for a single view controller by adding the hubview as subview and changing the origin of view when making swipe. But With this approach I have to add it to every view I implement in my app. I want to add it to UIViewController
as a category. I am not sure how to proceed at this point.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在这种情况下,类别不起作用,但子类化可以。只需确保所有视图控制器都是实现此功能的视图控制器的子类。
A category won't work in this case but subclassing will. Just ensure that all of your view controllers are sub classes of the view controller with this functionality implemented.
如果您不希望每个 viewController 都必须处理菜单,那么我建议使用一个像容器一样的根 viewController。它有一个子视图,显示来自各种视图控制器的内容,并且还具有菜单控件以及您可能想要提供的任何其他覆盖信息。
If you don't want every viewController to have to handle the menu then I would suggest having a root viewController that acts like a container. It has a subview that displays the content from your various view controllers and it also has the controls for your menu and any other overlay information you may want to provide.