//
//  JoinPartGuide2ViewController.m
//  Open
//
//  Created by 雷俊博 on 2020/4/30.
//  Copyright © 2020 黄江涛 . All rights reserved.
//

#import "JoinPartGuide2ViewController.h"
#import "JoinPartnerViewController.h"

@interface JoinPartGuide2ViewController ()

@property (nonatomic, strong)UIScrollView* scrollView;

@property (nonatomic, strong)UIButton* bottomButton;

@end

@implementation JoinPartGuide2ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor whiteColor];
       [self.view addSubview:self.scrollView];
       
       UIView*view = [[UIView alloc]initWithFrame:CGRectMake(0, ScreenHeight - 45, ScreenWidth, 45)];
       [view addSubview:self.bottomButton];
       [self.view addSubview:view];
}
- (void)btnClick:(UIButton *)sender {
    
    JoinPartnerViewController * joinVC = [JoinPartnerViewController new];
    [self.navigationController pushViewController:joinVC animated:YES];
}

- (CGFloat)getContentHeight
{
    UIImage* image = [UIImage imageNamed:@"partnerBg2"];
    CGFloat height = image.size.height * WIDTHRADIU;
    
    return height;
}

#pragma mark - getters and setters
- (UIScrollView *)scrollView
{
    if (!_scrollView) {
         _scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, cl_kNavigationBarHeight, ScreenWidth, ScreenHeight - cl_kNavigationBarHeight - 45)];
         _scrollView.backgroundColor = [UIColor whiteColor];
        
        
         _scrollView.contentSize = CGSizeMake(ScreenWidth, [self getContentHeight]);
               
         _scrollView.showsHorizontalScrollIndicator = NO;
        _scrollView.showsVerticalScrollIndicator = NO;
        
        UIImageView*imageView = [[UIImageView alloc]init];
        imageView.frame = CGRectMake(0, 0, ScreenWidth, [self getContentHeight]);
        imageView.image = [UIImage imageNamed:@"partnerBg2"];
        
        [_scrollView addSubview:imageView];
        
        
    }
    return _scrollView;
}

- (UIButton *)bottomButton
{
    if (!_bottomButton) {
        _bottomButton = [UIButton buttonWithType:UIButtonTypeCustom];
        _bottomButton.frame = CGRectMake(0, 0, ScreenWidth, 45);
        _bottomButton.backgroundColor = [UIColor colorWithHex:0x1C7DE8];
        _bottomButton.titleLabel.font = [UIFont systemFontOfSize:15];
        _bottomButton.titleLabel.hidden = NO;
        [_bottomButton setTitle:@"我要加入合伙人" forState:UIControlStateNormal];
        //[_bottomButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [_bottomButton addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _bottomButton;
}

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