88 lines
2.6 KiB
Objective-C
88 lines
2.6 KiB
Objective-C
//
|
|
// CreatErWeiMaController.m
|
|
// Ifish
|
|
//
|
|
// Created by imac on 15/12/2.
|
|
// Copyright © 2015年 imac. All rights reserved.
|
|
//
|
|
|
|
#import "CreatErWeiMaController.h"
|
|
#import "QRCodeGenerator.h"
|
|
#import "DeviceModel.h"
|
|
#import "UINavigationBar+Background.h"
|
|
#import "IfishDeviceInfo.h"
|
|
@interface CreatErWeiMaController ()
|
|
@property(nonatomic,strong)NSArray*arry;
|
|
@end
|
|
|
|
@implementation CreatErWeiMaController
|
|
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
UILabel*labe=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, 100, 44)];
|
|
labe.text=@"分享设备";
|
|
labe.textAlignment=NSTextAlignmentCenter;
|
|
labe.textColor=[UIColor whiteColor];
|
|
self.navigationItem.titleView=labe;
|
|
self.view.backgroundColor=COLOR_MIAN;
|
|
[self creatEr];
|
|
[self.view bringSubviewToFront:self.erWeiMaView];
|
|
if (_isNewdevice) {
|
|
[self.navigationController.navigationBar resetBackgroundImage];
|
|
}
|
|
}
|
|
-(void)creatEr{
|
|
// NSUserDefaults*userfult=[NSUserDefaults standardUserDefaults];
|
|
// NSInteger dex=[userfult integerForKey:@"lastIndex"];
|
|
// _arry=[[DataCenter defaultDtacenter]valueForKey:@"deviceInfo"];
|
|
// DeviceModel*devicemodel=[[DeviceModel alloc]init];
|
|
// if (dex) {
|
|
// devicemodel=_arry[dex];
|
|
// }else{
|
|
// devicemodel=_arry[0];
|
|
// }
|
|
|
|
//DeviceModel*model=[_arry objectAtIndex:0];//分享选中设备
|
|
if ([self.erdevicemodel.deviceId isKindOfClass:[NSNumber class]]) {
|
|
self.erdevicemodel.deviceId=[NSString stringWithFormat:@"%ld",self.erdevicemodel.deviceId.integerValue];
|
|
}
|
|
NSString*type=@"deviceId";
|
|
if ([_erdevicemodel.type isEqualToString:DECICE_TYPE_XUANDUO3F]) {
|
|
type=@"petdeviceId";
|
|
}
|
|
else if (self.deviceid.length)
|
|
{
|
|
type=@"cameraId";
|
|
}
|
|
NSString*str=[NSString stringWithFormat:@"%@=%@",type,self.erdevicemodel.deviceId.length?self.erdevicemodel.deviceId:[CommonUtils getNotNilStr:self.deviceid]];
|
|
self.erWeiMaView.image=[QRCodeGenerator qrImageForString:str imageSize:self.erWeiMaView.bounds.size.width];
|
|
if ([self.erdevicemodel.type isEqualToString:DECICE_TYPE_XUANDUO3F])
|
|
{
|
|
self.tips.text=@"点击扫一扫,和我一起控制我的宠物笼吧!";
|
|
}
|
|
else if (self.deviceid)
|
|
{
|
|
self.tips.text=@"点击扫一扫,和我一起控制我的摄像头吧!";
|
|
}
|
|
else if (self.deviceid)
|
|
{
|
|
self.tips.text=@"点击扫一扫,和我一起控制我的水族箱吧!";
|
|
}
|
|
|
|
|
|
|
|
}
|
|
- (void)didReceiveMemoryWarning {
|
|
|
|
[super didReceiveMemoryWarning];
|
|
|
|
}
|
|
|
|
-(void)viewWillAppear:(BOOL)animated{
|
|
|
|
self.navigationController.navigationBarHidden =NO;
|
|
|
|
}
|
|
|
|
@end
|