前几天学的抽屉效果,然后没有搞懂,今天又实现了一遍。估计还在在一些小小bug,有待进一步完善
//
// ViewController.m
// 08-抽屉效果
//
// Created by styshy on 15/11/2.
// Copyright (c) 2015年 sz. All rights reserved.
//
#import "ViewController.h"
#define maxY 60
@interface ViewController () <UIGestureRecognizerDelegate>
@property (nonatomic,weak) UIView *blueV;
@property (nonatomic,weak) UIView *greenV;
@property (nonatomic,weak) UIView *mainV;
@property (nonatomic,assign) BOOL isDraging;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
// 添加所有子控件
[self addAllChildren];
// kvo观察者模式
[self.mainV addObserver:self forKeyPath:@"frame" options:NSKeyValueObservingOptionNew context:nil];
}
- (void)addAllChildren{
// 蓝色
UIView *blueV