//
// StudyHelpDetailVC.m
// LNMobileProject
//
// Created by Liu Cheng on 2019/7/10.
//
#import "StudyHelpDetailVC.h"
#import <WebKit/WebKit.h>
@interface StudyHelpDetailVC () <WKNavigationDelegate>
@property (weak, nonatomic) IBOutlet EXTView *viewContainer;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *constraintContainerHeight;
@property (strong, nonatomic) WKWebView *webView;
@end
@implementation StudyHelpDetailVC
#pragma mark - ---- 生命周期 ----
- (void)viewDidLoad {
[super viewDidLoad];
[self initUI];
[self updateUI];
[self loadData];
}
#pragma mark - ---- 私有方法 ----
- (void)initUI {
self.navigationItem.title = @"详情";
self.webView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:WKWebViewConfiguration.new];
self.webView.navigationDelegate = self;
[self.viewContainer addSubview:self.webView];
[self.webView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.bottom.right.offset(0);
}];
@weakify(self);
[self.KVOController observe:self.webView.scrollView keyPath:@"contentSize" options:0 block:^(id _Nullable observer, id _Nonnull object, NSDictionary<NSKeyValueChangeKey,id> * _Nonnull change) {
@strongify(self);
self.constraintContainerHeight.constant = self.webView.scrollView.contentSize.height;
}];
[SVProgressHUD show];
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.url]]];
}
- (void)updateUI {
}
- (void)loadData {
}
#pragma mark - ---- 代理相关 ----
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {
[SVProgressHUD dismiss];
}
#pragma mark - ---- 用户交互 ----
@end