IOS 簡單抽屜效果

2021-06-23 03:37:14 字數 1541 閱讀 7821

// 引入每三方類庫

mmdrawercontroller

// 引入 mmdrawercontroller.h

mmdrawervisualstate.h

// 左右兩個抽屜的controller 和mainviewcontroller

mainviewcontroller.h

leftviewcontroller.h

rightviewcontroller.h

// 初始化

mainviewcontroller *mainvc = [[mainviewcontroller alloc] init];

leftviewcontroller *leftvc = [[leftviewcontroller alloc] init];

rightviewcontroller *rightvc = [[rightviewcontroller alloc] init];

//  左右抽屜初始化

mmdrawercontroller *drawervc = [[mmdrawercontroller alloc] initwithcenterviewcontroller:mainvc leftdrawerviewcontroller:leftvc rightdrawerviewcontroller:rightvc];

//  抽屜寬度

[drawervc setmaximumleftdrawerwidth:270];

[drawervc setmaximumrightdrawerwidth:270];

// 抽屜開啟/關閉(左右滑動)手勢設定   預設為關閉

[drawervc setopendrawergesturemodemask:mmopendrawergesturemodeall];

[drawervc setclosedrawergesturemodemask:mmclosedrawergesturemodeall];

// 抽屜動畫效果

[drawervc setdrawervisualstateblock:[mmdrawervisualstate swingingdoorvisualstateblock]];

self.window.rootviewcontroller = drawervc;

[mainvc release];

[leftvc release];

[rightvc release];

[drawervc release];

[_window release];

mainviewcontroller.m

// 引入

#import

"mmdrawerbarbuttonitem.h"

#import "uiviewcontroller+mmdrawercontroller.h"

// 1.自定義按鈕

// 2.

邊欄按鈕方法 

-(void)leftdrawerbuttonpress:(id)sender

-(void)rightdrawerbuttonpress:(id)sender

簡單的iOS抽屜效果

define screenw uiscreen mainscreen bounds.size.width import viewcontroller.h inte ceviewcontroller property nonatomic,strong uiview redview property n...

抽屜效果重寫

這是主介面的內容,可以拖動主介面實現效果 mainviewcontroller.m wangyidrawer created by xiaoyao on 15 2 9.import mainviewcontroller.h import leftviewcontroller.h import rig...

XMG 抽屜效果

1.比如說我建立了3個view void viewdidload 如果想要監聽乙個物件的某個屬性可以使用kvo 只要監聽的屬性一改變,就會呼叫觀察者的這個方法,通知你有新值 void observevalueforkeypath nsstring keypath ofobject id object...