Skip to content

Instantly share code, notes, and snippets.

@gliubc
Created July 10, 2019 03:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gliubc/c7d62fce7d0a5fd552aabbfe9417b32f to your computer and use it in GitHub Desktop.
Save gliubc/c7d62fce7d0a5fd552aabbfe9417b32f to your computer and use it in GitHub Desktop.
//
// 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment