Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
882 | 2 years ago | 22 | mit | Objective-C | ||||||
🔥 iOS 利用MVVM + RAC + ViewModel-Based Navigation来搭建微信(WeChat 7.0.0+)的整体基本架构,以及实现微信朋友圈、通讯录、下拉小程序、搜索等主要功能,代码规范惊为天人、注释详解令人发指、细节处理精益求精、核心功能配备文档、接近98%还原度的原生App视觉体验,代码不多,注释多。(持续更新,敬请期待,欢迎Star和Fork…) | ||||||||||
Mhdevelopexample_objective_c | 825 | 3 years ago | 8 | mit | Objective-C | |||||
🔥🔥🔥 iOS开发技术要点汇总。表情键盘布局、大文件分片上传、基于MVC的基类设计、MVVM+RAC实践、微信朋友圈实现方案。 | ||||||||||
Axwebviewcontroller | 745 | 8 | 4 years ago | 45 | February 22, 2018 | 48 | mit | Objective-C | ||
AXWebViewController is a webViewController to browse web content inside applications. It’s a lightweight controller on iOS platform based on WKWebView (UIWebView would be the base Kit under iOS 8.0). It added navigation tool bar to refresh, go back, go forward and so on. It support the navigation style on WeChat. It is a simple-using and convenient web view controller using inside applications. | ||||||||||
Rn Wechat | 569 | 4 years ago | 20 | JavaScript | ||||||
基于ReactNative的高仿微信客户端,支持Android和iOS。 | ||||||||||
Vhlnavigation | 206 | 3 years ago | 3 | July 03, 2018 | 4 | mit | Objective-C | |||
导航栏切换之颜色过渡切换,导航栏背景图片切换,微信红包两种不同颜色切换,导航栏透明度,有无导航栏切换 | ||||||||||
Navigation Bar | 154 | 1 | 4 years ago | 3 | August 24, 2018 | 7 | mit | JavaScript | ||
weapp custom component -- navigation-bar | ||||||||||
Lywebviewcontroller | 128 | 6 years ago | 3 | October 09, 2017 | 4 | mit | Objective-C | |||
LYWebViewController is a WebViewController based on WKWebView and UIWebView. It added navigation tool bar to refresh, go back, go forward and so on. It support the navigation style on WeChat. | ||||||||||
Weapp Navigation Bar | 115 | 4 years ago | 2 | JavaScript | ||||||
一个自适应的微信小程序自定义导航栏组件。 | ||||||||||
Wxnavigationbar | 114 | 10 months ago | 32 | October 09, 2020 | 6 | mit | Swift | |||
Handle UINavigationBar like WeChat. Simple and easy to use. | ||||||||||
Hhnavigationcontroller Demo | 55 | 7 years ago | 2 | Objective-C | ||||||
HHNavigationController demo |
AXWebViewController
是一款基于WKWebView(WebKit)
封装的view controller,高度集成,一行代码即可使用;能够满足大部分的App加载html网页的场景,AXWebViewController
实现了WKUIDelegate
和WKNavigationDelegate
两个协议,在使用过程中,若需要自定义功能,可自行Overrides相关方法予以实现;
AXWebViewController
可实现微信样式的网页浏览导航控制,可在导航栏显示返回
和关闭
两个功能按钮,这个功能主要基于AXNavigationBackItemInjection
而实现,AXNavigationBackItemInjection可以拦截点击返回导航或者手势滑动返回,有兴趣的朋友可以了解了解!
- 手势滑动返回上个页面
- 微信样式导航返回、关闭
- 网页加载失败提示
- 网页加载进度提示
- 网页来源host提示
- 支持__Peek__和__Pop__浏览网页,并且commit之后在本网页进行加载,不用跳转到Safari进行浏览,这里使用到了很多运行时的方法,因此,谨慎使用!
AXWebViewController
对系统版本支持到iOS7.0;版本0.7.0
以后仅支持Xcode9
,需要使用到:
- Foundation.framework
- UIKit.framework
使用的时候最好使用最新版Xcode。
CocoaPods is the recommended way to add AXWebViewController to your project.
AXWebViewController
to your Podfile pod 'AXWebViewController', '~> 0.6.0'
pod install
.AXWebViewController
wherever you need it with #import "AXWebViewController.h"
.Alternatively you can directly add the source files under path */AXWebViewController/
to your project.
AXWebViewController
wherever you need it with #import "AXWebViewController.h"
.This code is distributed under the terms and conditions of the MIT license.
AXWebViewController
使用和使用普通UIViewController
一样简单,只需要在需要使用的地方使用URL
初始化即可:
AXWebViewController *webVC = [[AXWebViewController alloc] initWithAddress:@"http://www.baidu.com"];
webVC.showsToolBar = NO;
webVC.navigationController.navigationBar.translucent = NO;
self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:0.100f green:0.100f blue:0.100f alpha:0.800f];
self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:0.996f green:0.867f blue:0.522f alpha:1.00f];
[self.navigationController pushViewController:webVC animated:YES];
使用工具条只需在AXWebViewController
初始化之后加入一句代码:
webVC.navigationType = AXWebViewControllerNavigationToolItem;
webVC.showsToolBar = YES;
注意,在设置navigationType
为AXWebViewControllerNavigationToolItem
之后,须确认showsToolBar
为YES
才能生效.
在AXWebViewController
初始化之后加入一句代码:
webVC.navigationType = AXWebViewControllerNavigationBarItem;
即可生效.
Peek和Pop使用的是原生的系统功能,在使用的时候只需要将webView.allowsLinkPreview
设置为YES
即可使用,这里需要注意下,在实现Peek和Pop的时候,使用了Runtime的相关知识,而且使用AOP的一个框架__Aspects__进行了编程,在使用的过程中可能会出错,当然,出错的几率也是很小的(苹果不可能隔三差五的去修改自家的Private API吧= =),实现原理就不多讲了,基本上就是运行时的一些知识,代码如下:
- (void)hookWebContentCommitPreviewHandler {
// Find the `WKContentView` in the webview.
__weak typeof(self) wself = self;
for (UIView *_view in _webView.scrollView.subviews) {
if ([_view isKindOfClass:NSClassFromString(@"WKContentView")]) {
id _previewItemController = object_getIvar(_view, class_getInstanceVariable([_view class], "_previewItemController"));
Class _class = [_previewItemController class];
SEL _performCustomCommitSelector = NSSelectorFromString(@"previewInteractionController:interactionProgress:forRevealAtLocation:inSourceView:containerView:");
[_previewItemController aspect_hookSelector:_performCustomCommitSelector withOptions:AspectPositionAfter usingBlock:^() {
UIViewController *pred = [_previewItemController valueForKeyPath:@"presentedViewController"];
[pred aspect_hookSelector:NSSelectorFromString(@"_addRemoteView") withOptions:AspectPositionAfter usingBlock:^() {
UIViewController *_remoteViewController = object_getIvar(pred, class_getInstanceVariable([pred class], "_remoteViewController"));
[_remoteViewController aspect_hookSelector:@selector(viewDidLoad) withOptions:AspectPositionAfter usingBlock:^() {
_remoteViewController.view.tintColor = wself.navigationController.navigationBar.tintColor;
} error:NULL];
} error:NULL];
NSArray *ddActions = [pred valueForKeyPath:@"ddActions"];
id openURLAction = [ddActions firstObject];
[openURLAction aspect_hookSelector:NSSelectorFromString(@"perform") withOptions:AspectPositionInstead usingBlock:^ () {
NSURL *_url = object_getIvar(openURLAction, class_getInstanceVariable([openURLAction class], "_url"));
[wself loadURL:_url];
} error:NULL];
id _lookupItem = object_getIvar(_previewItemController, class_getInstanceVariable([_class class], "_lookupItem"));
[_lookupItem aspect_hookSelector:NSSelectorFromString(@"commit") withOptions:AspectPositionInstead usingBlock:^() {
NSURL *_url = object_getIvar(_lookupItem, class_getInstanceVariable([_lookupItem class], "_url"));
[wself loadURL:_url];
} error:NULL];
[_lookupItem aspect_hookSelector:NSSelectorFromString(@"commitWithTransitionForPreviewViewController:inViewController:completion:") withOptions:AspectPositionInstead usingBlock:^() {
NSURL *_url = object_getIvar(_lookupItem, class_getInstanceVariable([_lookupItem class], "_url"));
[wself loadURL:_url];
} error:NULL];
/*
UIWindow
-UITransitionView
--UIVisualEffectView
---_UIVisualEffectContentView
----UIView
-----_UIPreviewActionSheetView
*/
/*
for (UIView * transitionView in [UIApplication sharedApplication].keyWindow.subviews) {
if ([transitionView isMemberOfClass:NSClassFromString(@"UITransitionView")]) {
transitionView.tintColor = wself.navigationController.navigationBar.tintColor;
for (UIView *__view in transitionView.subviews) {
if ([__view isMemberOfClass:NSClassFromString(@"UIVisualEffectView")]) {
for (UIView *___view in __view.subviews) {
if ([___view isMemberOfClass:NSClassFromString(@"_UIVisualEffectContentView")]) {
for (UIView *____view in ___view.subviews) {
if ([____view isMemberOfClass:NSClassFromString(@"UIView")]) {
__weak typeof(____view) w____view = ____view;
[____view aspect_hookSelector:@selector(addSubview:) withOptions:AspectPositionAfter usingBlock:^() {
for (UIView *actionSheet in w____view.subviews) {
if ([actionSheet isMemberOfClass:NSClassFromString(@"_UIPreviewActionSheetView")]) {
break;
}
}
} error:NULL];
}
}break;
}
}break;
}
}break;
}
}
*/
} error:NULL];
break;
}
}
}
RxWebViewController为我提供了思路,有些地方做了参考
iOS8.0
以下使用了NJKWebViewProgress作为进度条,感谢!
使用基于UIWebView
的实现,进度条使用NJKWebViewProgress
实现.
iOS8.0以上使用WKWebView
实现,进度条使用UIProgressView
实现. 实现了本页面Peek&Pop而不用跳转到Safari进行浏览.
使用AXNavigationBackItemInjection实现微信导航样式,也可以自定义返回的操作,只需要几行代码就可以搞定!
Latest release
.