ifish/Ifish/controllers/ConnectAauariumVC/ConAquarMethodVC.m

132 lines
4.5 KiB
Objective-C

//
// ConAquarMethodVC.m
// Ifish
//
// Created by wbzhan on 2019/9/20.
// Copyright © 2019 lianlian. All rights reserved.
//
#import "ConAquarMethodVC.h"
#import "SecondConnectWifiController.h"
#import "ConAquarNowWiFiPwdVC.h"
@interface ConAquarMethodVC ()
Strong UILabel *subTitleLabel;
@end
@implementation ConAquarMethodVC
- (void)viewDidLoad {
[super viewDidLoad];
[self addTitleViewWithTitle:self.titleString];
[self.view addSubview:self.subTitleLabel];
NSArray *imageArr = @[@"icons_con_01",@"icons_con_02"];
NSArray *titleArr = @[@"智能连接",@"热点连接"];
for (int i=0; i<2; i++) {
UIButton *contentView = InitObject(UIButton);
[contentView addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside];
contentView.tag = i;
[self.view addSubview:contentView];
contentView.backgroundColor = XWhite;
contentView.layer.cornerRadius = kSizeFrom750(10);
contentView.layer.masksToBounds = YES;
[contentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.view);
make.width.mas_equalTo(kSizeFrom750(650));
make.height.mas_equalTo(kSizeFrom750(140));
make.top.mas_equalTo(self.subTitleLabel.mas_bottom).offset(kSizeFrom750(60)+i*kSizeFrom750(200));
}];
UIImageView *iconImage = InitObject(UIImageView);
[iconImage setImage:IMAGEBYENAME(imageArr[i])];
[contentView addSubview:iconImage];
[iconImage mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(contentView);
make.left.mas_equalTo(kSizeFrom750(50));
make.width.height.mas_equalTo(kSizeFrom750(84));
}];
UILabel *titleL = InitObject(UILabel);
titleL.text = titleArr[i];
titleL.textColor = RGB(130, 130, 130);
titleL.font = FontSize(18);
[contentView addSubview:titleL];
[titleL mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(iconImage.mas_right).offset(kSizeFrom750(30));
make.centerY.mas_equalTo(iconImage);
}];
UIImageView *rightArrow = InitObject(UIImageView);
[rightArrow setImage:IMAGEBYENAME(@"right_arrow")];
[contentView addSubview:rightArrow];
[rightArrow mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(titleL);
make.right.mas_equalTo(-kSizeFrom750(30));
make.width.height.mas_equalTo(kSizeFrom750(44));
}];
}
self.view.backgroundColor = COLOR_Background;
// Do any additional setup after loading the view.
}
-(void)buttonClick:(UIButton *)sender{
self.hidesBottomBarWhenPushed = YES;
if (sender.tag==0) {
if (self.deviceType==DEVICECAMERA)
{
YooseeNextConnectViewController *nextvc=[[YooseeNextConnectViewController alloc] init];
nextvc.conectType = conectType_Intelligent;
[self.navigationController pushViewController:nextvc animated:YES];
}
else
{
SecondConnectWifiController *wifivc=[[SecondConnectWifiController alloc]init];
wifivc.deviceType=self.deviceType;
wifivc.vcTitle=self.titleString;
[self.navigationController pushViewController:wifivc animated:YES];
}
}else{
ConAquarNowWiFiPwdVC *vc = InitObject(ConAquarNowWiFiPwdVC);
vc.deviceType=self.deviceType;
NSDictionary *netInfo = [CommonUtils getSSIDInfo];
vc.ssid = [netInfo objectForKey:@"SSID"];
vc.bssid = [netInfo objectForKey:@"BSSID"];
vc.deviceType=self.deviceType;
[self.navigationController pushViewController:vc animated:YES];
}
}
- (UILabel *)subTitleLabel
{
if (!_subTitleLabel) {
_subTitleLabel = InitObject(UILabel);
_subTitleLabel.font = FontSize(16);
_subTitleLabel.text = @"请选择合适的连接方式";
_subTitleLabel.textColor = RGB_92;
}
return _subTitleLabel;
}
/*
#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