YIem`s Blog -心比天高命比纸薄-链接找不到的请在站内搜索内容!

iOS-UI- SetViewController-抽屉效果


SetViewController *setVC = [[SetViewController alloc]init];

// 注意坐标设置
setVC.view.frame = CGRectMake(-150, 0, 150, self.view.frame.size.height);

    [self addChildViewController:setVC];
[self.view addSubview:setVC.view];
[setVC release];
// 增加边缘手势
UIScreenEdgePanGestureRecognizer *screenGR = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(screenAction:)];
screenGR.edges = UIRectEdgeLeft;
[self.view addGestureRecognizer:screenGR];
[screenGR release];
// 增加轻拍手势 点击收回抽屉
UITapGestureRecognizer *tapGR = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction:)];
[self.firstVC.view addGestureRecognizer:tapGR];
[tapGR release];

抽屉效果实现

// 抽屉收回

// 抽屉效果

当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »