This commit is contained in:
启星
2025-08-08 10:49:36 +08:00
parent 6400cf78bb
commit b5ce3d580a
8780 changed files with 978183 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
//
// QXChatViewController.h
// QXLive
//
// Created by 启星 on 2025/5/22.
//
#import "QXBaseViewController.h"
#import "TUIC2CChatViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXChatViewController : QXBaseViewController
@property (nonatomic,strong)TUIChatConversationModel *data;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,133 @@
//
// QXChatViewController.m
// QXLive
//
// Created by on 2025/5/22.
//
#import "QXChatViewController.h"
#import "QXChatTitleView.h"
#import "TUIGroupChatViewController.h"
#import "TUIChatConfig_Classic.h"
#import "QXUserHomePageViewController.h"
#import "QXGuildGroupSettingVC.h"
@interface QXChatViewController ()<TUIChatConfigDelegate_Classic>
@property (nonatomic,strong)QXChatTitleView *titleView;
@end
@implementation QXChatViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
//
// TUIC2CChatViewController
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES];
}
-(void)setNavgationItems{
[super setNavgationItems];
UIButton*backBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)];
[backBtn setImage:[UIImage imageNamed:@"back"] forState:(UIControlStateNormal)];
// backBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeading;
[backBtn addTarget:self action:@selector(backAction) forControlEvents:(UIControlEventTouchUpInside)];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backBtn];
}
-(BOOL)onUserAvatarClicked:(UIView *)view messageCellData:(TUIMessageCellData *)celldata{
QXUserHomePageViewController *vc = [[QXUserHomePageViewController alloc] init];
NSString *userId = [celldata.identifier stringByReplacingOccurrencesOfString:@"u" withString:@""];
vc.user_id = userId;
[self.navigationController pushViewController:vc animated:YES];
return YES;
}
//-(BOOL)onUserAvatarLongPressed:(UIView *)view messageCellData:(TUIMessageCellData *)celldata{
// return YES;
//}
//
//- (BOOL)onMessageClicked:(nonnull UIView *)view messageCellData:(nonnull TUIMessageCellData *)celldata {
// return YES;
//}
//
//
//- (BOOL)onMessageLongPressed:(nonnull UIView *)view messageCellData:(nonnull TUIMessageCellData *)celldata {
// return YES;
//}
-(void)backAction{
if (self.navigationController.viewControllers.count > 1) {
[self.navigationController popViewControllerAnimated:YES];
return;
}else{
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
}
}
-(void)moreAction{
QXGuildGroupSettingVC *vc = [[QXGuildGroupSettingVC alloc] init];
vc.groupId = [self.data.groupID stringByReplacingOccurrencesOfString:@"g" withString:@""];
[self.navigationController pushViewController:vc animated:YES];
}
- (void)initSubViews{
[TUIChatConfig_Classic sharedConfig].delegate = self;
if (self.data.groupID.length>0) {
TUIGroupChatViewController *vc = [[TUIGroupChatViewController alloc] init];
[vc setConversationData:self.data];
// TUIC2CChatViewController ViewController
vc.view.frame = CGRectMake(0, NavContentHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight);
[self addChildViewController:vc];
[self.view addSubview:vc.view];
UIButton*moreBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)];
[moreBtn setImage:[UIImage imageNamed:@"dynamic_more"] forState:(UIControlStateNormal)];
// backBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeading;
[moreBtn addTarget:self action:@selector(moreAction) forControlEvents:(UIControlEventTouchUpInside)];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:moreBtn];
}else{
TUIC2CChatViewController *vc = [[TUIC2CChatViewController alloc] init];
[vc setConversationData:self.data];
// TUIC2CChatViewController ViewController
vc.view.frame = CGRectMake(0, NavContentHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight);
[self addChildViewController:vc];
[self.view addSubview:vc.view];
}
}
-(void)setData:(TUIChatConversationModel *)data{
_data = data;
self.navigationItem.title = data.title;
// self.titleView.nameLabel.text = data.title;
// if (data.avatarImage != nil) {
// self.titleView.imageView.image = data.avatarImage;
// }else{
// [self.titleView.imageView sd_setImageWithURL:[NSURL URLWithString:data.faceUrl] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
// }
//
// self.titleView.timeLabel.text = @"刚刚";
}
-(QXChatTitleView *)titleView{
if (!_titleView) {
_titleView = [[QXChatTitleView alloc] initWithFrame:CGRectMake(10, 0, SCREEN_WIDTH-100, 44)];
}
return _titleView;
}
/*
#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

View File

@@ -0,0 +1,19 @@
//
// QXMessageViewController.h
// QXLive
//
// Created by 启星 on 2025/4/24.
//
#import "QXBaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXMessageViewController : QXBaseViewController
@property (nonatomic,assign)BOOL isFromRoom;
-(instancetype)initWithIsFromRoom:(BOOL)isFromRoom;
-(void)reloadConversions;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,141 @@
//
// QXMessageViewController.m
// QXLive
//
// Created by on 2025/4/24.
//
#import "QXMessageViewController.h"
#import <ImSDK_Plus/ImSDK_Plus.h>
#import <ImSDK_Plus/V2TIMManager+Conversation.h>
#import "TUIConversationListController.h"
#import "QXChatViewController.h"
#import "QXSystemTopView.h"
#import "QXSystemNoticeViewController.h"
#import "QXMessageServices.h"
@interface QXMessageViewController ()<TUIConversationListControllerListener,QXSystemTopViewDelegate>
@property (nonatomic,strong)QXSystemTopView *topView;
@property (nonatomic,strong)QXMessageModel *model;
@property (nonatomic,strong)TUIConversationListController *vc;
@end
@implementation QXMessageViewController
-(instancetype)initWithIsFromRoom:(BOOL)isFromRoom{
if (self = [super init]) {
self.isFromRoom = isFromRoom;
if (self.isFromRoom) {
self.view.frame = CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(429));
}
}
return self;
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadConversions) name:noticeTencentLogin object:nil];
// [self performSelector:@selector(chat) afterDelay:5];
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:YES animated:YES];
[self getHomeMessage];
}
-(void)initSubViews{
UILabel *tLabel = [[UILabel alloc] init];
tLabel.text = QXText(@"消息");
tLabel.font = [UIFont boldSystemFontOfSize:20];
[self.view addSubview:tLabel];
[tLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.top.mas_equalTo(kSafeAreaTop);
make.height.mas_equalTo(40);
}];
TUIConversationListController *vc = [[TUIConversationListController alloc] init];
vc.delegate = self;
// TUIConversationListController ViewController
// vc.tableViewForAll.backgroundColor = [UIColor clearColor];
self.vc = vc;
vc.view.backgroundColor = [UIColor clearColor];
vc.view.frame = CGRectMake(0, NavContentHeight, SCREEN_WIDTH, self.view.height-NavContentHeight);
if (self.isFromRoom) {
tLabel.font = [UIFont boldSystemFontOfSize:17];
[tLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.view);
make.top.equalTo(self.view).offset(10);
make.height.mas_equalTo(35);
}];
vc.view.frame = CGRectMake(0, 40, SCREEN_WIDTH, self.view.height);
}else{
vc.tableViewForAll.tableHeaderView = self.topView;
}
self.vc = vc;
[self addChildViewController:vc];
[self.view addSubview:vc.view];
}
-(void)reloadConversions{
[self.vc.view removeFromSuperview];
[self.vc removeFromParentViewController];
self.vc = nil;
self.vc = [[TUIConversationListController alloc] init];
self.vc.view.frame = CGRectMake(0, NavContentHeight, SCREEN_WIDTH, self.view.height-NavContentHeight);
self.vc.tableViewForAll.tableHeaderView = self.topView;
[self addChildViewController:self.vc];
[self.view addSubview:self.vc.view];
}
- (void)conversationListController:(UIViewController *)conversationController
didSelectConversation:(TUIConversationCellData *)conversation {
//
// if (conversation.groupID.length > 0) {
//
// }else{
QXChatViewController *vc = [[QXChatViewController alloc] init];
TUIChatConversationModel *data = [[TUIChatConversationModel alloc] init];
data.conversationID = conversation.conversationID;
data.userID = conversation.userID;
data.groupID = conversation.groupID;
data.title = conversation.title;
data.faceUrl = conversation.faceUrl;
vc.data = data;
[self.navigationController pushViewController:vc animated:YES];
// }
}
//-(void)viewDidLayoutSubviews{
// [super viewDidLayoutSubviews];
// self.vc.view.frame = CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(429));
//}
-(void)getHomeMessage{
MJWeakSelf
[QXMessageServices getHomeMessageSuccessBlock:^(QXMessageModel * _Nonnull model) {
weakSelf.model = model;
weakSelf.topView.model = model;
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
//-(void)chat{
// TUIChatConversationModel *data = [[TUIChatConversationModel alloc] init];
// data.userID = @"10086";
// QXChatViewController *vc = [[QXChatViewController alloc] init];
// vc.data = data;
// [self.navigationController pushViewController:vc animated:YES];
//}
-(void)didClickNoticeWithType:(NSInteger)type{
QXSystemNoticeViewController *vc = [[QXSystemNoticeViewController alloc] init];
vc.type = type;
[self.navigationController pushViewController:vc animated:YES];
}
-(QXSystemTopView *)topView{
if (!_topView) {
_topView = [[QXSystemTopView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 74*2+8)];
_topView.delegate = self;
}
return _topView;
}
@end

View File

@@ -0,0 +1,17 @@
//
// QXSystemNoticeViewController.h
// QXLive
//
// Created by 启星 on 2025/5/28.
//
#import "QXBaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXSystemNoticeViewController : QXBaseViewController
/// 0 官方公告 1系统通知
@property (nonatomic,assign)NSInteger type;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,122 @@
//
// QXSystemNoticeViewController.m
// QXLive
//
// Created by on 2025/5/28.
//
#import "QXSystemNoticeViewController.h"
#import "QXSystemNoticeCell.h"
#import "QXSystemMessageCell.h"
#import "QXMessageServices.h"
#import "AppDelegate.h"
@interface QXSystemNoticeViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,assign)CGFloat rowHeight;
@end
@implementation QXSystemNoticeViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES];
}
-(void)setNavgationItems{
[super setNavgationItems];
if (self.type == 0) {
self.navigationItem.title = QXText(@"官方公告");
}else{
self.navigationItem.title = QXText(@"系统消息");
}
}
- (void)initSubViews{
self.page = 1;
if (self.type == 0) {
self.rowHeight = 280;
}else{
self.rowHeight = 91;
}
[self.view addSubview:self.tableView];
[self getMessageList];
}
-(void)getMessageList{
MJWeakSelf
[QXMessageServices getMessageListWithPage:self.page type:self.type == 0?@"2":@"1" successBlock:^(NSArray<QXMessageListModel *> * _Nonnull list) {
if (weakSelf.page == 1) {
[weakSelf.dataArray removeAllObjects];
}
[weakSelf.dataArray addObjectsFromArray:list];
[weakSelf.tableView reloadData];
if (list.count == 0) {
weakSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData;
}else{
[weakSelf.tableView.mj_footer endRefreshing];
}
[weakSelf.tableView.mj_header endRefreshing];
AppDelegate *appdelegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
appdelegate.tabbarVC.systemUnreadNumber = 0;
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
[weakSelf.tableView.mj_header endRefreshing];
[weakSelf.tableView.mj_footer endRefreshing];
}];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
if (self.type == 0) {
QXSystemNoticeCell *cell = [QXSystemNoticeCell cellWithTableView:tableView];
cell.model = self.dataArray[indexPath.row];
return cell;
}else{
QXSystemMessageCell *cell = [QXSystemMessageCell cellWithTableView:tableView];
cell.model = self.dataArray[indexPath.row];
return cell;
}
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
QXMessageListModel *model = self.dataArray[indexPath.row];
if (model.room_id.integerValue > 0) {
[[QXGlobal shareGlobal] joinRoomWithRoomId:model.room_id isRejoin:NO navagationController:self.navigationController];
}else{
if ([model.url hasPrefix:@"http"] || [model.url hasPrefix:@"https"]) {
QXBaseWebViewController *vc = [[QXBaseWebViewController alloc] init];
vc.urlStr = model.url;
[self.navigationController pushViewController:vc animated:YES];
}
}
}
-(UITableView *)tableView{
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavContentHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight) style:(UITableViewStylePlain)];
_tableView.dataSource = self;
_tableView.delegate = self;
_tableView.backgroundColor = [UIColor clearColor];
_tableView.rowHeight = 60;
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
_tableView.rowHeight = UITableViewAutomaticDimension;
_tableView.estimatedRowHeight = self.rowHeight;
MJWeakSelf
_tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
weakSelf.page = 1;
[weakSelf getMessageList];
}];
_tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
weakSelf.page++;
[weakSelf getMessageList];
}];
}
return _tableView;
}
@end

View File

@@ -0,0 +1,16 @@
//
// QXGuildGroupSettingVC.h
// QXLive
//
// Created by 启星 on 2025/6/7.
//
#import "QXBaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXGuildGroupSettingVC : QXBaseViewController
@property (nonatomic,strong)NSString *groupId;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,234 @@
//
// QXGuildGroupSettingVC.m
// QXLive
//
// Created by on 2025/6/7.
//
#import "QXGuildGroupSettingVC.h"
#import <WebKit/WebKit.h>
#import "QXUserHomePageViewController.h"
static void *WKWebBrowserContext = &WKWebBrowserContext;
@interface QXGuildGroupSettingVC ()<WKScriptMessageHandler>
@property(nonatomic,strong)WKWebView *contentWebView;
@property(nonatomic,strong)UIProgressView *progressView;
@end
@implementation QXGuildGroupSettingVC
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self.view addSubview:self.contentWebView];
[self.view addSubview:self.progressView];
[self layoutConstraints];
[self loadData];
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:YES animated:YES];
}
//-(void)setNavgationItems{
// [super setNavgationItems];
// self.navigationItem.title = @"段位";
//}
- (void)layoutConstraints {
[self.contentWebView setFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
[self.progressView setFrame:CGRectMake(0, 0, SCREEN_WIDTH
, 2)];
}
- (void)loadData {
NSURL* url=[NSURL URLWithString:[NSString stringWithFormat:@"https://vespa.qxmier.com/web/index.html#/pages/union/setGroup?id=%@&guildId=%@",QXGlobal.shareGlobal.loginModel.token,self.groupId]];
NSURLRequest *request =[NSURLRequest requestWithURL:url];
[self.contentWebView loadRequest:request];
}
#pragma mark - WKNavigationDelegate
//
- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation{
//
self.progressView.hidden = NO;
}
//
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
//
// if (self.title.length == 0) {
// self.navigationItem.title = self.contentWebView.title;
// }
// if ([self.titleString containsString:@"转账"]) {
// //
// NSString *fontFamilyStr = @"document.getElementsByTagName('body')[0].style.fontFamily='Arial';";
// [webView evaluateJavaScript:fontFamilyStr completionHandler:nil];
// //
// [ webView evaluateJavaScript:@"document.getElementsByTagName('body')[0].style.webkitTextFillColor= '#333333'" completionHandler:nil];
// //
// [ webView evaluateJavaScript:@"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '150%'"completionHandler:nil];
// }
}
//
- (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation {
}
//
- (void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavigation:(WKNavigation *)navigation {
}
//
- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error{
}
-(void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message{
NSLog(@"message.name====%@ body=%@",message.name,message.body);
if([message.name isEqualToString:@"nativeHandler"]){
NSDictionary *dict = message.body;
if ([dict[@"action"] isEqualToString:@"closeWeb"]) {
if (self.contentWebView.canGoBack) {
[self.contentWebView goBack];
}else{
[self.navigationController popViewControllerAnimated:YES];
}
}else if ([dict[@"action"] isEqualToString:@"jumpWebPage"]) {
NSString *userId = [NSString stringWithFormat:@"%@",dict[@"data"][@"userId"]];
if (userId.longLongValue == 0) {
return;
}
QXUserHomePageViewController *vc = [[QXUserHomePageViewController alloc] init];
vc.user_id = userId;
[self.navigationController pushViewController:vc animated:YES];
}else if ([dict[@"action"] isEqualToString:@"jumpRoomPage"]) {
NSString *room_id = [NSString stringWithFormat:@"%@",dict[@"data"][@"room_id"]];
if (room_id.longLongValue == 0) {
return;
}
[[QXGlobal shareGlobal] joinRoomWithRoomId:room_id isRejoin:NO navagationController:self.navigationController];
}else if ([dict[@"action"] isEqualToString:@"chatWithUser"]) {
NSString *userId = [NSString stringWithFormat:@"%@",dict[@"data"][@"userId"]];
NSString *userName = [NSString stringWithFormat:@"%@",dict[@"data"][@"userName"]];
if (userId.longLongValue == 0) {
return;
}
[[QXGlobal shareGlobal] chatWithUserID:userId nickname:userName avatar:@"" navagationController:self.navigationController];
}
}
}
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
//
if (navigationAction.targetFrame == nil) {
[webView loadRequest:navigationAction.request];
}
NSURL *URL = navigationAction.request.URL;
[self dealSomeThing:URL];
decisionHandler(WKNavigationActionPolicyAllow);
}
- (void)dealSomeThing:(NSURL *)url{
NSString *scheme = [url scheme];
NSString *resourceSpecifier = [url resourceSpecifier];
if ([scheme isEqualToString:@"tel"]) {
NSString *callPhone = [NSString stringWithFormat:@"tel://%@", resourceSpecifier];
/// iOS 10
dispatch_async(dispatch_get_global_queue(0, 0), ^{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:callPhone]];
});
}
}
//
- (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView {
}
//KVO
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
if ([keyPath isEqualToString:NSStringFromSelector(@selector(estimatedProgress))] && object == self.contentWebView) {
[self.progressView setAlpha:1.0f];
BOOL animated = self.contentWebView.estimatedProgress > self.progressView.progress;
[self.progressView setProgress:self.contentWebView.estimatedProgress animated:animated];
// Once complete, fade out UIProgressView
if(self.contentWebView.estimatedProgress >= 1.0f) {
[UIView animateWithDuration:0.3f delay:0.3f options:UIViewAnimationOptionCurveEaseOut animations:^{
[self.progressView setAlpha:0.0f];
} completion:^(BOOL finished) {
[self.progressView setProgress:0.0f animated:NO];
}];
}
}
else {
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
}
#pragma mark - getters and setters
- (WKWebView *)contentWebView {
if (!_contentWebView) {
//
WKWebViewConfiguration * configuration = [[WKWebViewConfiguration alloc]init];
//
configuration.selectionGranularity = YES;
// webpr
configuration.processPool = [[WKProcessPool alloc] init];
//, jsoc(OCURL)
WKUserContentController * UserContentController = [[WKUserContentController alloc]init];
//
configuration.suppressesIncrementalRendering = NO;
//
[UserContentController addScriptMessageHandler:self name:@"nativeHandler"];
configuration.preferences.javaScriptEnabled = YES;
configuration.preferences.javaScriptCanOpenWindowsAutomatically = YES;
configuration.userContentController = UserContentController;
// iOS9iOS8
if ([[UIDevice currentDevice].systemVersion floatValue] >= 9.0) {
//
configuration.allowsAirPlayForMediaPlayback = YES;
// 线
configuration.allowsInlineMediaPlayback = YES;
// NOios8
_contentWebView.allowsBackForwardNavigationGestures = YES;
}
_contentWebView = [[WKWebView alloc] initWithFrame:self.view.bounds configuration:configuration];
_contentWebView.backgroundColor = [UIColor clearColor];
_contentWebView.opaque = YES;
//
[_contentWebView sizeToFit];
_contentWebView.scrollView.showsVerticalScrollIndicator = NO;
//
_contentWebView.navigationDelegate = self;
//kvo
[_contentWebView addObserver:self forKeyPath:NSStringFromSelector(@selector(estimatedProgress)) options:0 context:WKWebBrowserContext];
}
return _contentWebView;
}
- (UIProgressView *)progressView {
if (!_progressView) {
_progressView = [[UIProgressView alloc]initWithProgressViewStyle:UIProgressViewStyleDefault];
[_progressView setTrackTintColor:[UIColor colorWithRed:240.0/255 green:240.0/255 blue:240.0/255 alpha:1.0]];
_progressView.progressTintColor = QXConfig.themeColor;
}
return _progressView;
}
-(void)setProgressColor:(UIColor *)progressColor{
_progressView.progressTintColor = progressColor;
}
// dealloc
- (void)dealloc {
if (self) {
[self.contentWebView removeObserver:self forKeyPath:NSStringFromSelector(@selector(estimatedProgress))];
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
@end