//
//  ManagementSmartWatchesVC.m
//  gaotingshan
//
//  Created by MacBook Dq01 on 16/4/28.
//  Copyright © 2016年 Xu Mengzhu. All rights reserved.
//

#import "ManagementSmartWatchesVC.h"
#import "Singleton.h"


@interface ManagementSmartWatchesVC () <UIWebViewDelegate> {
    Singleton *singleton;
}

@property (nonatomic, strong) UIWebView *webView;

@end

@implementation ManagementSmartWatchesVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    singleton = [Singleton defaultSingleton];
    
    self.view.frame = [UIScreen mainScreen].bounds;
    self.view.backgroundColor = [UIColor colorWithRed:241/255. green:241/255. blue:241/255. alpha:0.9];
    self.navigationItem.title = @"管理我的智能手表";
    
//      [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"nav_bg"] forBarMetrics:(UIBarMetricsDefault)];
//    //改变字体颜色
//    NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];
//    textAttrs[NSForegroundColorAttributeName] = [UIColor whiteColor];
//    self.navigationController.navigationBar.titleTextAttributes = textAttrs;
    
    [Manager setNavi:self.navigationController.navigationBar];
    
    
#pragma - 设置导航栏左边的按钮
 //   self.navigationItem.leftBarButtonItem = [Manager rightItemTarget:self img:@"nav_back" tag:1000000 action:@selector(magLeftBarBtnIsClicked)];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"nav_back"] landscapeImagePhone:nil style:UIBarButtonItemStylePlain target:self action:@selector(magLeftBarBtnIsClicked)];
    self.navigationItem.leftBarButtonItem.tintColor = [UIColor whiteColor];
    
    [self loadWebView];
    
}

#pragma mark - webView加载方法；
- (void)loadWebView {
    //webView加载页面.
    _webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    [_webView setUserInteractionEnabled:YES];
    _webView.delegate = self;
    [_webView setOpaque:NO]; //设置是否透明。
    [_webView setScalesPageToFit:YES]; //自动缩放以适应屏幕。
    //加载网页.
    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@/terminal/myBracelet?sesskey=%@#",localRequestUrl, singleton.sesskey]];
    [_webView loadRequest:[NSURLRequest requestWithURL:url]];
    [self.view addSubview:_webView];
    
}

#pragma mark - 导航栏左边按钮被点击
- (void)magLeftBarBtnIsClicked {
    //回到上一级界面.
    [self dismissViewControllerAnimated:YES completion:nil];
    
}



////////////////////////////////////////
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

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