179 lines
5.1 KiB
Objective-C
179 lines
5.1 KiB
Objective-C
//
|
|
// SelectDeviceViewController.m
|
|
// Ifish
|
|
//
|
|
// Created by imac on 16/6/27.
|
|
// Copyright © 2016年 lianxiang. All rights reserved.
|
|
//
|
|
|
|
#import "SelectDeviceViewController.h"
|
|
#import "FirstConnectWifiController.h"
|
|
#import "LeftViewController.h"
|
|
#import "ICSDrawerController.h"
|
|
#import "YooseConnectFirstViewController.h"
|
|
#import "IfishMianTabViewController.h"
|
|
@interface SelectDeviceViewController ()
|
|
@property(nonatomic,strong)ICSDrawerController*ics;
|
|
@end
|
|
extern BOOL formLogIn;//连接页面是否来自登录界面
|
|
extern BOOL isfromCameraView;
|
|
|
|
@implementation SelectDeviceViewController
|
|
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
|
|
// 添加鱼缸设备不是来自摄像头界面
|
|
isfromCameraView = NO;
|
|
|
|
|
|
[self initUI];
|
|
self.view.backgroundColor = COLOR_MIAN;
|
|
[self addTitleViewWithTitle:@"选择设备"];
|
|
// UIButton*rightButton = [[UIButton alloc]initWithFrame:CGRectMake(25,0,60,60)];
|
|
// [rightButton setTitle:@"跳过" forState:UIControlStateNormal];
|
|
// rightButton.backgroundColor=[UIColor clearColor];
|
|
// [rightButton addTarget:self action:@selector(passClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
// UIImageView*imageView=[[UIImageView alloc]initWithFrame:CGRectMake(25,0,60,60)];
|
|
|
|
|
|
// [imageView addSubview:rightButton];
|
|
// imageView.userInteractionEnabled=YES;
|
|
// UIBarButtonItem*rightItem = [[UIBarButtonItem alloc]initWithCustomView:imageView];
|
|
// self.navigationItem.rightBarButtonItem = rightItem;
|
|
|
|
|
|
// if (formLogIn==YES) {// 判断是否来自登录界面 隐藏返回按钮
|
|
// formLogIn=NO;
|
|
// rightButton.hidden=NO;
|
|
//
|
|
// self.bakbutton.hidden=YES;
|
|
// }else if (formLogIn==NO){
|
|
//
|
|
// rightButton.hidden=YES;
|
|
// self.bakbutton.hidden=NO;
|
|
//
|
|
// }
|
|
|
|
// Do any additional setup after loading the view.
|
|
UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];
|
|
self.navigationItem.backBarButtonItem = item;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pragma mark - 暂时跳过
|
|
|
|
-(void)passClick:(UIButton*)btn{
|
|
|
|
|
|
IfishMianTabViewController *mianVC=[[IfishMianTabViewController alloc] init];
|
|
|
|
|
|
[UIApplication sharedApplication].delegate.window.rootViewController=mianVC;
|
|
|
|
|
|
}
|
|
|
|
-(void)initUI{
|
|
|
|
CGFloat BarHeit = 64;
|
|
CGFloat botomSpace = 44;
|
|
CGFloat spaceH = 50;
|
|
|
|
UILabel *bindLabel=[[UILabel alloc] initWithFrame:CGRectMake(0,BarHeit + 50, kScreenSize.width, 30)];
|
|
bindLabel.textColor = [UIColor whiteColor];
|
|
bindLabel.textAlignment = NSTextAlignmentCenter;
|
|
bindLabel.text = @"请选择您要绑定的设备类型";
|
|
[self.view addSubview:bindLabel];
|
|
|
|
CGFloat btnWid= (kScreenSize.height - 64 - botomSpace - 4*spaceH -30)/2 ;
|
|
|
|
UIButton *tankBtn=[UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
tankBtn.frame =CGRectMake(kScreenSize.width/2 - btnWid/2, CGRectGetMaxY(bindLabel.frame) + spaceH, btnWid, btnWid);
|
|
[tankBtn setBackgroundImage:[UIImage imageNamed:@"ifish_tank_logo"] forState:UIControlStateNormal];
|
|
|
|
[tankBtn addTarget:self action:@selector(tankBtn:) forControlEvents:UIControlEventTouchUpInside];
|
|
[self.view addSubview:tankBtn];
|
|
|
|
|
|
UIButton *yooseeBtn=[UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
yooseeBtn.frame =CGRectMake(kScreenSize.width/2 - btnWid/2, CGRectGetMaxY(tankBtn.frame) + spaceH, btnWid, btnWid);
|
|
[yooseeBtn setBackgroundImage:[UIImage imageNamed:@"ifish_yoosee_logo"] forState:UIControlStateNormal];
|
|
[yooseeBtn addTarget:self action:@selector(yooseeBtn:) forControlEvents:UIControlEventTouchUpInside];
|
|
[self.view addSubview:yooseeBtn];
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)didReceiveMemoryWarning {
|
|
[super didReceiveMemoryWarning];
|
|
// Dispose of any resources that can be recreated.
|
|
}
|
|
|
|
|
|
-(void)tankBtn:(UIButton*)btn{
|
|
NSArray * deviceArr =[[DataCenter defaultDtacenter]valueForKey:@"deviceInfo"];
|
|
|
|
if ([deviceArr count]>=5) {
|
|
|
|
[self.view makeToast:@"设备已达上线限"];
|
|
return;
|
|
|
|
}
|
|
|
|
self.hidesBottomBarWhenPushed = YES;
|
|
FirstConnectWifiController *first = [[FirstConnectWifiController alloc] init];
|
|
|
|
[self.navigationController pushViewController:first animated:YES];
|
|
|
|
}
|
|
|
|
-(void)yooseeBtn:(UIButton*)btn{
|
|
NSArray * cameraArr =[[DataCenter defaultDtacenter]valueForKey:@"cameraArr"];
|
|
|
|
if ([cameraArr count]>=5) {
|
|
|
|
[self.view makeToast:@"设备已达上线限"];
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
self.hidesBottomBarWhenPushed = YES;
|
|
YooseConnectFirstViewController *fistVC=[[YooseConnectFirstViewController alloc] init];
|
|
|
|
[self.navigationController pushViewController:fistVC animated:YES];
|
|
|
|
|
|
}
|
|
|
|
-(void)viewWillAppear:(BOOL)animated{
|
|
|
|
|
|
|
|
}
|
|
|
|
/*
|
|
#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
|