//
//  HelpViewController.m
//  Lighting
//
//  Created by mac on 16/5/30.
//  Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//

#import "HelpViewController.h"
@interface HelpViewController ()
@end
@implementation HelpViewController
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.helpArray=[[NSMutableArray alloc]initWithObjects:@"返回",@"添加至购物袋",@"分享方案",@"自定义场景",@"全屏",@"帮助", nil];
    [self initView];
    
}

-(void)initView
{
    for (int i=0; i<self.helpArray.count; i++) {
        UIButton *button=[UIButton buttonWithType:UIButtonTypeCustom];
        button.tag=100+i;
        [button setBackgroundImage:[UIImage imageNamed:@"lefttool1"] forState:UIControlStateNormal];
        switch (i) {
            case 0:
                button.frame=CGRectMake(90, 30+(60 +15)*i, 100, 60);
               
                break;
            case 1:
                button.frame=CGRectMake(75, 30+(60 +15)*i, 200, 60);
                break;
            case 2:
                 button.frame=CGRectMake(80, 30+(60 +15)*i, 150, 60);
                break;
            case 3:
                button.frame=CGRectMake(75, 30+(60 +15)*i, 200, 60);
                break;
            case 4:
                button.frame=CGRectMake(90, 30+(60 +15)*i, 100, 60);
                break;
            case 5:
                button.frame=CGRectMake(90, 30+(60 +15)*i, 100, 60);
                break;
                
            default:
                break;
        }
         [button setTitle:[self.helpArray objectAtIndex:i] forState:UIControlStateNormal];
        [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal ];
        [self.view addSubview:button];
    }
    UIButton *sencenBtn=[[UIButton alloc]initWithFrame:CGRectMake(25, self.view.frame.size.height-155, 150, 60)];
    [sencenBtn setBackgroundImage:[UIImage imageNamed:@"downtool"] forState:UIControlStateNormal];
    [sencenBtn setTitle:@"选择场景" forState:UIControlStateNormal];
     sencenBtn.contentEdgeInsets = UIEdgeInsetsMake(0, 0, 8, 0);
    [sencenBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self.view addSubview:sencenBtn];
    UIButton *productBtn=[[UIButton alloc]initWithFrame:CGRectMake(self.view.frame.size.width-245, self.view.frame.size.height-210, 150, 60)];
    [productBtn setBackgroundImage:[UIImage imageNamed:@"righttool"] forState:UIControlStateNormal];
    [productBtn setTitle:@"选择产品" forState:UIControlStateNormal];
    [productBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self.view addSubview:productBtn];

    
    //点击手势
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(DismissScreenView:)];
    tap.delegate = self;
    tap.cancelsTouchesInView = NO;
    [[UIApplication sharedApplication].keyWindow addGestureRecognizer:tap];
}
//取消当前页面点击手势
-(void)DismissScreenView:(UITapGestureRecognizer*)sender{
//    CGPoint point = [sender locationInView:self.view];
  
            if (self) {
                if ([self.delegate respondsToSelector:@selector(restHelpBtnImage)]) {
                    [self.delegate restHelpBtnImage];
                }

            [self.view removeFromSuperview];
        }
   
}

@end
