Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
GMBase
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
GMBase
Commits
207e661f
Commit
207e661f
authored
May 26, 2020
by
luyueming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改获取当前控制器
parent
8cd23190
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
24 deletions
+6
-24
GMBaseTool.m
GMBase/Classes/AddClass/GMBaseTool.m
+6
-24
No files found.
GMBase/Classes/AddClass/GMBaseTool.m
View file @
207e661f
...
...
@@ -19,36 +19,18 @@
+
(
UIViewController
*
)
getCurrentViewController
{
UIViewController
*
currentViewController
=
[
self
getRootViewController
];
BOOL
runLoopFind
=
YES
;
while
(
runLoopFind
)
{
if
(
currentViewController
.
presentedViewController
)
{
if
(
currentViewController
.
presentedViewController
)
{
//present
currentViewController
=
currentViewController
.
presentedViewController
;
}
else
if
([
currentViewController
isKindOfClass
:[
UINavigationController
class
]])
{
UINavigationController
*
navigationController
=
(
UINavigationController
*
)
currentViewController
;
currentViewController
=
[
navigationController
.
childViewControllers
lastObject
];
}
else
if
([
currentViewController
isKindOfClass
:[
UITabBarController
class
]])
{
UITabBarController
*
tabBarController
=
(
UITabBarController
*
)
currentViewController
;
currentViewController
=
tabBarController
.
selectedViewController
;
}
else
{
NSUInteger
childViewControllerCount
=
currentViewController
.
childViewControllers
.
count
;
if
(
childViewControllerCount
>
0
)
{
currentViewController
=
currentViewController
.
childViewControllers
.
lastObject
;
return
currentViewController
;
}
else
if
([
currentViewController
isKindOfClass
:
NSClassFromString
(
@"WMMainTabBarViewController"
)])
{
//一级页面
UIViewController
*
vc
=
(
UIViewController
*
)[
currentViewController
valueForKey
:
@"current"
];
return
vc
;
}
else
{
UINavigationController
*
navigationController
=
(
UINavigationController
*
)
currentViewController
;
currentViewController
=
navigationController
.
visibleViewController
;
return
currentViewController
;
}
}
}
return
currentViewController
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment