//
//  EachScoreVC.m
//  gaotingshan
//
//  Created by Mac Book DQ02 on 16/7/28.
//  Copyright © 2016年 Xu Mengzhu. All rights reserved.
//参赛人员单个成绩，附带心率和记步页面

#import "EachScoreVC.h"

@interface EachScoreVC ()

@end

@implementation EachScoreVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [[UIApplication sharedApplication] setStatusBarHidden:YES];
    
    self.navigationItem.title = @"个人成绩";
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"nav_bg800"] forBarMetrics:(UIBarMetricsDefault)];
    //改变字体颜色
    NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];
    textAttrs[NSForegroundColorAttributeName] = [UIColor whiteColor];
    self.navigationController.navigationBar.titleTextAttributes = textAttrs;
    
#pragma - 设置导航栏左边的按钮
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"nav_back"] landscapeImagePhone:nil style:UIBarButtonItemStylePlain target:self action:@selector(leftBarButtonItemIsClicked:)];
    self.navigationItem.leftBarButtonItem.tintColor = [UIColor whiteColor];
    
    
    //以下是对webView的一些处理。
    _webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.height, self.view.frame.size.width-20)];
    [_webView setUserInteractionEnabled:YES];
    _webView.delegate = self;
    [_webView setOpaque:NO]; //设置是否透明。
    [_webView setScalesPageToFit:YES]; //自动缩放以适应屏幕。
    //加载网页
    NSURL *url = [NSURL URLWithString:_requestUrl];
    [_webView loadRequest:[NSURLRequest requestWithURL:url]];
    [self.view addSubview:_webView];
    
}

-(void)leftBarButtonItemIsClicked:(id)sender
{
    [self dismissViewControllerAnimated:NO completion:nil];
    [[UIApplication sharedApplication] setStatusBarHidden:NO];
}

-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
    return YES;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

-(BOOL)shouldAutorotate
{
    return YES;
}

-(UIInterfaceOrientationMask)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}

#pragma mark --解决个人成绩页面，状态栏隐藏问题
- (BOOL)prefersStatusBarHidden
{
    return YES;
}

- (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
