减少中心屏幕 alpha 时出现 MMDrawerController 错误
MMDrawerController error when reducing center screen alpha
我正在使用 MMDrawerController 在我的 ios 应用程序中创建侧边栏,我已经成功地实现了它,但是我正试图在侧边栏显示时减少中心视图的 alpha,正如您通常在大多数具有类似功能的应用程序,但我收到错误
Type of expression is ambiguius without more context
这是我的 AppDelegate 中的代码,visualstateblock 部分抛出错误
func buildNavigationDrawer()
{
// Instantiate Main.storyboard
let mainStoryBoard:UIStoryboard = UIStoryboard(name:"Main", bundle:nil)
// Create View Controllers
let mainPage:TabBarViewController = mainStoryBoard.instantiateViewController(withIdentifier: "TabBarViewController") as! TabBarViewController
let rightSideMenu:HomeSideMenuViewController = mainStoryBoard.instantiateViewController(withIdentifier: "HomeSideMenuViewController") as! HomeSideMenuViewController
// Wrap into Navigation controllers
let rightSideMenuNav = UINavigationController(rootViewController:rightSideMenu)
// Cerate MMDrawerController
drawerContainer = MMDrawerController(center: mainPage, rightDrawerViewController: rightSideMenuNav)
//drawerContainer!.openDrawerGestureModeMask = MMOpenDrawerGestureMode.PanningCenterView
drawerContainer!.closeDrawerGestureModeMask = MMCloseDrawerGestureMode.panningCenterView
drawerContainer!.setDrawerVisualStateBlock { (drawerContainer, rightSideMenuNav) in
drawerContainer!.centerViewController.view.alpha = 0.3;
}
// Assign MMDrawerController to our window's root ViewController
window?.rootViewController = drawerContainer
}
感谢您的帮助
在setDrawerVisualStateBlock
中,返回的MMDrawerController
不是可选的,但它后面仍然有一个force wrapper !
这是告诉编译器从上一行(您创建的那一行)中获取可选值
要解决此问题,请更改其中一个变量名称或使用此名称:
drawerContainer?.setDrawerVisualStateBlock { [=10=].0.centerViewController.view.alpha = 0.3 }
我正在使用 MMDrawerController 在我的 ios 应用程序中创建侧边栏,我已经成功地实现了它,但是我正试图在侧边栏显示时减少中心视图的 alpha,正如您通常在大多数具有类似功能的应用程序,但我收到错误
Type of expression is ambiguius without more context
这是我的 AppDelegate 中的代码,visualstateblock 部分抛出错误
func buildNavigationDrawer()
{
// Instantiate Main.storyboard
let mainStoryBoard:UIStoryboard = UIStoryboard(name:"Main", bundle:nil)
// Create View Controllers
let mainPage:TabBarViewController = mainStoryBoard.instantiateViewController(withIdentifier: "TabBarViewController") as! TabBarViewController
let rightSideMenu:HomeSideMenuViewController = mainStoryBoard.instantiateViewController(withIdentifier: "HomeSideMenuViewController") as! HomeSideMenuViewController
// Wrap into Navigation controllers
let rightSideMenuNav = UINavigationController(rootViewController:rightSideMenu)
// Cerate MMDrawerController
drawerContainer = MMDrawerController(center: mainPage, rightDrawerViewController: rightSideMenuNav)
//drawerContainer!.openDrawerGestureModeMask = MMOpenDrawerGestureMode.PanningCenterView
drawerContainer!.closeDrawerGestureModeMask = MMCloseDrawerGestureMode.panningCenterView
drawerContainer!.setDrawerVisualStateBlock { (drawerContainer, rightSideMenuNav) in
drawerContainer!.centerViewController.view.alpha = 0.3;
}
// Assign MMDrawerController to our window's root ViewController
window?.rootViewController = drawerContainer
}
感谢您的帮助
在setDrawerVisualStateBlock
中,返回的MMDrawerController
不是可选的,但它后面仍然有一个force wrapper !
这是告诉编译器从上一行(您创建的那一行)中获取可选值
要解决此问题,请更改其中一个变量名称或使用此名称:
drawerContainer?.setDrawerVisualStateBlock { [=10=].0.centerViewController.view.alpha = 0.3 }