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
6c169d93
Commit
6c169d93
authored
Apr 05, 2017
by
汪洋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导航栏可以单独控制
parent
e374e207
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
2 deletions
+11
-2
.gitignore
.gitignore
+1
-1
WMBaseViewController.h
GMBase/Classes/WMBaseViewController.h
+6
-0
WMBaseViewController.m
GMBase/Classes/WMBaseViewController.m
+4
-1
No files found.
.gitignore
View file @
6c169d93
...
...
@@ -29,4 +29,4 @@ Carthage
# Note: if you ignore the Pods directory, make sure to uncomment
# `pod install` in .travis.yml
#
#
Pods/
Pods/
GMBase/Classes/WMBaseViewController.h
View file @
6c169d93
...
...
@@ -13,6 +13,12 @@
@interface
WMBaseViewController
:
UIViewController
<
OCNavigatioinBarDelegate
>
@property
(
nonatomic
,
strong
)
OCNavigatioinBar
*
navigationBar
;
/**
默认值为NO,表示导航栏自动被WMBaseViewController管理,永远在所有的view最上方。
设置为YES时表示因为特殊需求,开发人员需要自己控制导航,并且需要在viewDidLoad中确定navigationBar的位置
*/
@property
(
nonatomic
,
assign
)
BOOL
controlNavigationByYou
;
/**
* @brief 因为controller会有initWithCoder,init,initWithNib三种方式,为了避免子类代码的疏忽导致父类自定义init内容没有覆盖到,所以统一使用initController方法。需要调用super
*/
...
...
GMBase/Classes/WMBaseViewController.m
View file @
6c169d93
...
...
@@ -43,6 +43,7 @@
}
-
(
void
)
initController
{
self
.
controlNavigationByYou
=
NO
;
// 在 initController 中初始化自定义导航栏有很大好处。至少可以保证视图被push之前就可以访问navigationBar,以配置title等属性
[
self
customNavigationBar
];
}
...
...
@@ -64,7 +65,9 @@
[
super
viewDidLayoutSubviews
];
// 保证即使在loading的时候,仍然可以后退
[
self
.
view
bringSubviewToFront
:
self
.
navigationBar
];
if
(
!
self
.
controlNavigationByYou
)
{
[
self
.
view
bringSubviewToFront
:
self
.
navigationBar
];
}
}
-
(
void
)
didMoveToParentViewController
:
(
UIViewController
*
)
parent
{
...
...
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