mirror of
https://github.com/DKJone/DKWechatHelper.git
synced 2025-05-23 02:26:09 +08:00
适配IPad
解决IPad打开小助手崩溃问题
This commit is contained in:
parent
63d6a01cee
commit
009b2f1455
Binary file not shown.
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Bucket
|
||||
type = "1"
|
||||
version = "2.0">
|
||||
</Bucket>
|
Binary file not shown.
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 4.3 KiB |
|
@ -12,12 +12,20 @@
|
|||
#import "DKGroupFilterController.h"
|
||||
@interface DKHelperSettingController ()<MultiSelectGroupsViewControllerDelegate>{
|
||||
WCTableViewManager * manager;
|
||||
MMUIViewController *helper;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation DKHelperSettingController
|
||||
|
||||
-(instancetype)init{
|
||||
if (self = [super init]) {
|
||||
helper = [[objc_getClass("MMUIViewController") alloc] init];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
self.title = @"小助手设置";
|
||||
|
@ -259,4 +267,13 @@
|
|||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
|
||||
|
||||
// 没法设置父类,设置消息转发以调用相关类方法
|
||||
- (MMUIViewController *) forwardingTargetForSelector:(SEL)aSelector {
|
||||
if ([helper respondsToSelector:aSelector]) {
|
||||
return helper;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -26,18 +26,15 @@
|
|||
|
||||
|
||||
+ (UINavigationController *)navigationContrioller{
|
||||
|
||||
UITabBarController * tabbarVC = (UITabBarController *)UIApplication.sharedApplication.keyWindow.rootViewController;
|
||||
NSArray<UINavigationController *> *vcs = tabbarVC.childViewControllers;
|
||||
|
||||
return vcs[tabbarVC.selectedIndex];
|
||||
return ((UINavigationController *)([objc_getClass("CAppViewControllerManager") getCurrentNavigationController]));
|
||||
}
|
||||
|
||||
+ (UIBarButtonItem *)leftNavigationItem{
|
||||
|
||||
UINavigationController * navc = [DKHelper navigationContrioller];
|
||||
if (navc.viewControllers.count > 1){
|
||||
return ((UIViewController *)navc.viewControllers[1]).navigationItem.leftBarButtonItem;
|
||||
for (UIViewController *vc in navc.childViewControllers) {
|
||||
UIBarButtonItem * item = vc.navigationItem.leftBarButtonItem;
|
||||
if (item) { return item; }
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
|
|
@ -319,6 +319,18 @@
|
|||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@interface CAppViewControllerManager: NSObject
|
||||
|
||||
+ (id)topViewControllerOfWindow:(id)arg1;
|
||||
+ (id)topViewControllerOfMainWindow;
|
||||
+ (id)topMostController;
|
||||
+ (id)getCurrentNavigationController;
|
||||
+ (id)getTabBarController;
|
||||
+ (id)getAppViewControllerManager;
|
||||
|
||||
@end
|
||||
#endif /* WechatHeaders_h */
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user