FollowHeartViewController.m 3.86 KB
Newer Older
曹云霄's avatar
曹云霄 committed
1
//
2
//  FollowHeartViewController.m
曹云霄's avatar
曹云霄 committed
3 4
//  Lighting
//
5
//  Created by 曹云霄 on 16/5/4.
曹云霄's avatar
曹云霄 committed
6 7 8
//  Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//

9
#import "FollowHeartViewController.h"
曹云霄's avatar
曹云霄 committed
10

11
@interface FollowHeartViewController ()
曹云霄's avatar
曹云霄 committed
12 13 14

@end

15
@implementation FollowHeartViewController
曹云霄's avatar
曹云霄 committed
16 17 18 19

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
zhu's avatar
zhu committed
20 21
    [self configSubView];
    
曹云霄's avatar
曹云霄 committed
22
}
zhu's avatar
zhu committed
23 24 25 26 27 28 29 30 31 32 33 34 35
-(void)configSubView
{
    UIImageView* imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"backView.png"]];
    imageView.frame=CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height);
    [self.view addSubview:imageView];
    self.leftSubView=[[LeftSubView alloc]initWithFrame:CGRectMake(0, 0, 200, self.view.bounds.size.height-200)];
    self.leftSubView.delegate=self;
    [self.view addSubview:self.leftSubView];
    self.rightSubView=[[RightSubView alloc]initWithFrame:CGRectMake(self.view.bounds.size.width-200, 0, 200, self.view.bounds.size.height-200)];
    [self.view addSubview:self.rightSubView];
    
    self.footSubView=[[FootSubView alloc]initWithFrame:CGRectMake(0, self.view.bounds.size.height-200, self.view.bounds.size.width, 200)];
    [self.view addSubview:self.footSubView];
曹云霄's avatar
曹云霄 committed
36

zhu's avatar
zhu committed
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109

}
#pragma  leftsubView  delegate
- (void)buttonClick:(NSInteger)btnTag withButton:(UIButton *)button
{
    switch (btnTag) {
        case 100:  //返回
        {
            [self.view removeFromSuperview];
        }
            break;
        case 101:  //购物车
        {
            
        }
            break;
        case 102:  //分享
        {
            
        }
            break;
        case 103:  //自定义场景
        {
            
        }
            break;
        case 104:  //全屏
        {

            [self setViewAnimations:button];
            
        }
            break;
        case 105: //帮助
        {
            
        }
            break;
            
        default:
            break;
    }

}
-(void)setViewAnimations:(UIButton *)sender
{
    UIButton *btn=[UIButton buttonWithType:UIButtonTypeCustom];
    btn.frame=sender.frame;
    [btn setTitle:@"缩小" forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(resetViewDidSelected:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];

    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDuration:1.0f];
    self.leftSubView.frame=CGRectMake(-200, 0, 200, self.view.bounds.size.height-200);
    self.rightSubView.frame=CGRectMake(self.view.bounds.size.width, 0, 200, self.view.bounds.size.height-200);
    self.footSubView.frame=CGRectMake(0, self.view.bounds.size.height, self.view.bounds.size.width, 200);
    btn.frame=CGRectMake(sender.frame.origin.x, 20, sender.frame.size.width, sender.frame.size.height);
    [UIView commitAnimations];
}
-(void)resetViewDidSelected:(UIButton *)sender
{
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDuration:1.0f];
    self.leftSubView.frame=CGRectMake(0, 0, 200, self.view.bounds.size.height-200);
    self.rightSubView.frame=CGRectMake(self.view.bounds.size.width-200, 0, 200, self.view.bounds.size.height-200);
    self.footSubView.frame=CGRectMake(0, self.view.bounds.size.height-200, self.view.bounds.size.width, 200);
    sender.hidden=YES;
    [UIView commitAnimations];

}
曹云霄's avatar
曹云霄 committed
110 111 112 113 114
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

115

曹云霄's avatar
曹云霄 committed
116 117 118 119 120 121 122 123 124 125 126
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end