【问题标题】:slide the view controller to the left on a button click (not side menu)单击按钮将视图控制器向左滑动(不是侧边菜单)
【发布时间】:2017-05-05 06:05:32
【问题描述】:

我正在尝试构建一个需要在单个屏幕上显示两个视图的应用程序,即白天和夜晚。当我单击夜视图上的夜间按钮时,我想将夜视图稍微向左移动。我尝试了侧边菜单,但它完全向左移动,我希望它像这样稍微向左移动:

【问题讨论】:

  • 你用的是哪个侧边菜单?
  • 使用github.com/John-Lluch/SWRevealViewController。或任何幻灯片菜单库来完成您的工作
  • @KKRocks 我使用了 MFSide 菜单,但它完全向左移动,我希望它稍微移动到 以便白天和夜间菜单都可见。

标签: ios objective-c viewcontroller


【解决方案1】:

尝试设置MFSideMenuContainerViewController'sleftMenuWidth属性。

container.leftMenuWidth = 50.0;

【讨论】:

  • 能否请您提供您的电子邮件 ID,以便我向您展示我的代码
  • @user3969152 你试过这个吗?
  • -(IBAction)moonButtonClicked:(id)sender { CGRect screenRect = [[UIScreen mainScreen] bounds]; [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.5]; _nightUIView.frame = CGRectMake(120, 00, (screenRect.size.width)/2, (screenRect.size.height -80)/2); [UIView 提交动画]; }这是任何有同样问题的人的工作代码:)
  • container.leftMenuWidth = 50.0;您需要在 appdelegate 中设置此代码。
  • MFsideMenu 提供默认动画。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-12-23
  • 2021-12-24
  • 1970-01-01
  • 1970-01-01
  • 2017-09-28
  • 2021-01-26
  • 2013-10-03
相关资源
最近更新 更多