效果图:
工程文件:
代码:
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.title=@"抽屉效果的实现"; UIView *uiview = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 380)]; UIImage *image = [UIImage imageNamed:@"test.jpg"]; UIImageView *imageView = [[UIImageView alloc]initWithImage:image]; imageView.center = uiview.center; [uiview addSubview:imageView]; DrawerView *testView = [[DrawerView alloc]initWithView:uiview parentView:self.view]; [self.view addSubview:testView]; }