FollowHeartViewController.m 5.65 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"
zhu's avatar
zhu committed
10 11
#import <QuartzCore/QuartzCore.h>
#import "ImageCropperView.h"
曹云霄's avatar
曹云霄 committed
12

13
@interface FollowHeartViewController ()
曹云霄's avatar
曹云霄 committed
14 15 16

@end

17
@implementation FollowHeartViewController
曹云霄's avatar
曹云霄 committed
18 19 20 21

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
zhu's avatar
zhu committed
22 23
    [self configSubView];
    
曹云霄's avatar
曹云霄 committed
24
}
zhu's avatar
zhu committed
25 26
-(void)configSubView
{
zhu's avatar
zhu committed
27 28 29
    self.backGroundImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"backView.png"]];
    self.backGroundImageView.frame=CGRectMake(0, 0, ScreenWidth, ScreenHeight);
    [self.view addSubview:self.backGroundImageView];
zhu's avatar
zhu committed
30
    self.leftSubView=[[LeftSubView alloc]initWithFrame:CGRectMake(0, 0, 200, ScreenHeight-150)];
zhu's avatar
zhu committed
31 32
    self.leftSubView.delegate=self;
    [self.view addSubview:self.leftSubView];
zhu's avatar
zhu committed
33
    self.rightSubView=[[RightSubView alloc]initWithFrame:CGRectMake(ScreenWidth-200, 0, 200, ScreenHeight-150)];
zhu's avatar
zhu committed
34
    self.rightSubView.delegate=self;
zhu's avatar
zhu committed
35 36
    [self.view addSubview:self.rightSubView];
    
zhu's avatar
zhu committed
37
    self.footSubView=[[FootSubView alloc]initWithFrame:CGRectMake(0, ScreenHeight-150, ScreenWidth, 150)];
zhu's avatar
zhu committed
38
    self.footSubView.delegate=self;
zhu's avatar
zhu committed
39
    [self.view addSubview:self.footSubView];
zhu's avatar
zhu committed
40
   
zhu's avatar
zhu committed
41
}
zhu's avatar
zhu committed
42

zhu's avatar
zhu committed
43
#pragma  subView  delegate
zhu's avatar
zhu committed
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
- (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: //帮助
        {
            
zhu's avatar
zhu committed
77 78 79 80 81 82 83 84 85 86
        }
            break;
        case 200: //场景
        {
            [self addSceneLibraryView];
        }
            break;
        case 300: //产品
        {
            [self addProductLibraryView];
zhu's avatar
zhu committed
87 88 89 90 91 92 93 94
        }
            break;
            
        default:
            break;
    }

}
zhu's avatar
zhu committed
95 96 97 98 99 100
//场景赋图回调
- (void)resetSuperBackGroundImage:(UIImage*)image
{
    self.backGroundImageView.image=image;
}
//产品附图回调
zhu's avatar
zhu committed
101
- (void)resetSubProductImage:(UIImage*)image
zhu's avatar
zhu committed
102 103 104 105 106 107 108
{
    ImageCropperView *cropper=[[ImageCropperView alloc]initWithFrame:CGRectMake(400, 300, 300, 300)];
    cropper.layer.borderWidth = 1.0;
    cropper.layer.borderColor = [UIColor blueColor].CGColor;
    cropper.image = image;
    [self.view addSubview:cropper];
}
zhu's avatar
zhu committed
109 110 111 112 113 114 115 116 117 118
//场景库选图回调
- (void)addSeceneImage:(UIImage *)image
{
    [self.footSubView addFootSubViewImage:image];
}
//产品库选图回调
- (void)addProductImage:(UIImage *)image
{
    [self.rightSubView addRightSubViewImage:image];
}
zhu's avatar
zhu committed
119
//全屏
zhu's avatar
zhu committed
120 121
-(void)setViewAnimations:(UIButton *)sender
{
zhu's avatar
zhu committed
122 123 124 125 126 127 128
    self.zoomButton=sender;
    self.zoomButton.hidden=YES;
    self.temporaryBtn=[UIButton buttonWithType:UIButtonTypeCustom];
    self.temporaryBtn.frame=sender.frame;
    [self.temporaryBtn setBackgroundImage:[UIImage imageNamed:@"xiaoping"] forState:UIControlStateNormal];
    [self.temporaryBtn addTarget:self action:@selector(resetViewDidSelected:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.temporaryBtn];
zhu's avatar
zhu committed
129

zhu's avatar
zhu committed
130
    [UIView beginAnimations:@"quanping" context:nil];
zhu's avatar
zhu committed
131 132
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDuration:1.0f];
zhu's avatar
zhu committed
133 134 135
    self.leftSubView.frame=CGRectMake(-200, 0, 200, ScreenHeight-150);
    self.rightSubView.frame=CGRectMake(ScreenWidth, 0, 200, ScreenHeight-150);
    self.footSubView.frame=CGRectMake(0, ScreenHeight, ScreenWidth, 150);
zhu's avatar
zhu committed
136
    self.temporaryBtn.frame=CGRectMake(sender.frame.origin.x, 20, sender.frame.size.width, sender.frame.size.height);
zhu's avatar
zhu committed
137 138 139 140
    [UIView commitAnimations];
}
-(void)resetViewDidSelected:(UIButton *)sender
{
zhu's avatar
zhu committed
141 142
    [sender setBackgroundImage:[UIImage imageNamed:@"quanping"] forState:UIControlStateNormal];
    [UIView beginAnimations:@"xiaoping" context:nil];
zhu's avatar
zhu committed
143
    [UIView setAnimationDelegate:self];
zhu's avatar
zhu committed
144
    [UIView setAnimationDidStopSelector:@selector(animationFinish)];
zhu's avatar
zhu committed
145
    [UIView setAnimationDuration:1.0f];
zhu's avatar
zhu committed
146 147 148
    self.leftSubView.frame=CGRectMake(0, 0, 200, ScreenHeight-150);
    self.rightSubView.frame=CGRectMake(ScreenWidth-200, 0, 200, ScreenHeight-150);
    self.footSubView.frame=CGRectMake(0, ScreenHeight-150, ScreenWidth, 150);
zhu's avatar
zhu committed
149
    sender.frame=self.zoomButton.frame;
zhu's avatar
zhu committed
150
    [UIView commitAnimations];
zhu's avatar
zhu committed
151 152 153 154 155 156
  
}
-(void)animationFinish
{
     self.zoomButton.hidden=NO;
    [self.temporaryBtn removeFromSuperview];
zhu's avatar
zhu committed
157
}
zhu's avatar
zhu committed
158 159 160
//添加场景
-(void)addSceneLibraryView
{
zhu's avatar
zhu committed
161 162 163 164
    self.seceneLibraryView=[[SeceneLibraryView alloc]init];
    self.seceneLibraryView.view.backgroundColor=[UIColor clearColor];
    self.seceneLibraryView.delegate=self;
    [self.view addSubview:self.seceneLibraryView.view];
zhu's avatar
zhu committed
165 166 167 168
}
//添加产品
-(void)addProductLibraryView
{
zhu's avatar
zhu committed
169 170 171 172
    self.productLibraryView=[[ProductLibraryView alloc]init];
   self.productLibraryView.view.backgroundColor=[UIColor clearColor];
    self.productLibraryView.delegate=self;
    [self.view addSubview:self.productLibraryView.view];
zhu's avatar
zhu committed
173
}
曹云霄's avatar
曹云霄 committed
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#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