iOS抽屜效果,ios抽屜
源碼下載
抽屜效果第三方類庫下載
所需第三方類庫下載
側拉欄抽屜
需要匯入的標頭檔:
#import "MMDrawerController.h"#import "MMExampleDrawerVisualStateManager.h"
代碼實現:
首先需要建立三個試圖控制器
//主視圖 FirstViewController *firstVC = [[FirstViewController alloc] init]; //左邊視圖 SecondViewController *secondVC = [[SecondViewController alloc] init]; //右邊視圖 ThirdViewController *thirdVC = [[ThirdViewController alloc] init]; CustomizedNavigationController *navigationVC = [[CustomizedNavigationController alloc] initWithRootViewController:firstVC]; CustomizedNavigationController *leftNavigationVC = [[CustomizedNavigationController alloc] initWithRootViewController:secondVC]; CustomizedNavigationController *rightNavigationVC = [[CustomizedNavigationController alloc] initWithRootViewController:thirdVC]; //抽屜管理 第三方 //該第三方既可以只實現開啟左側欄也可以實現開啟右側欄,還可以同時都實現 MMDrawerController *rooVC = [[MMDrawerController alloc] initWithCenterViewController:navigationVC leftDrawerViewController:leftNavigationVC rightDrawerViewController:rightNavigationVC]; //只實現開啟左側欄 //MMDrawerController *rooVCLeft = [[MMDrawerController alloc] initWithCenterViewController:navigationVC leftDrawerViewController:firstVC]; //只實現開啟右側欄 //MMDrawerController *rooVCRight = [[MMDrawerController alloc] initWithCenterViewController:navigationVC rightDrawerViewController:thirdVC]; //指定window的根視圖 self.window.rootViewController = rooVC; //測了門的寬度 [rooVC setMaximumLeftDrawerWidth:270]; //設定側拉門開與關的動畫 [rooVC setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll]; [rooVC setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll]; //側開內容展示效果 //設定向左滑動開啟右側欄 [[MMExampleDrawerVisualStateManager sharedManager] setRightDrawerAnimationType:MMDrawerAnimationTypeNone]; //設定向右滑動開啟左側欄 [[MMExampleDrawerVisualStateManager sharedManager] setLeftDrawerAnimationType:MMDrawerAnimationTypeNone]; [rooVC setDrawerVisualStateBlock:^(MMDrawerController *drawerController, MMDrawerSide drawerSide, CGFloat percentVisible) { MMDrawerControllerDrawerVisualStateBlock block; block = [[MMExampleDrawerVisualStateManager sharedManager] drawerVisualStateBlockForDrawerSide:drawerSide]; if(block){ block(drawerController, drawerSide, percentVisible); } }];
iOS中怎實作類別似網易ios用戶端那樣的抽屜互動菜單
類似網易的互動網上有專門的Demo,PPRevealSideViewController
ios抽屜效果 怎判斷抽屜的外部地區?怎去掉拖拽效果協助
可以將你的抽屜放在一個view中,就可以知道當前view在你的Vc的座標位置,你可以判斷離開這個地區不可用 查看原帖>>