首页
|
新闻
|
娱乐
|
游戏
|
科普
|
文学
|
编程
|
系统
|
数据库
|
建站
|
学院
|
产品
|
网管
|
维修
|
办公
|
热点
首页
>
学院
>
开发设计
> 正文
自定义tabBar
2019-11-07 23:25:35
字体:
大
中
小
来源:
转载
供稿:网友
//
//
XNTabBarController.m
//
//
//
Created
by
neng
on
14-6-19.
//
Copyright
(c)
2014年
neng.
All
rights
reserved.
//
#import
"XNTabBarController.h"
#import
"Common.h"
#import
"XNTabBarButton.h"
@interface
XNTabBarController
()
@
PR
operty
(
nonatomic
,
weak)
UIButton
*selectedBtn;
@end
@implementation
XNTabBarController
-
(
void
)viewDidLoad
{
[
super
viewDidLoad];
//下面两个方法在开发中是经常会用到的
//
NSLog(@"%s",__func__);
//
NSLog(@"%@",self.view.subviews);
//能打印出所有子视图,和其frame
LogFun;
LogSubviews(
self
.view);
//删除现有的tabBar
CGRect
rect
=
self
.tabBar.frame;
[
self
.tabBar
removeFromSuperview];
//移除TabBarController自带的下部的条
//测试添加自己的视图
UIView
*myView
=
[[UIView
alloc]
init];
myView.frame
=
rect;
myView.backgroundColor
=
[UIColor
redColor];
[
self
.view
addSubview:myView];
for
(
int
i
=
0;
i
<
5;
i++)
{
//UIButton
*btn
=
[[UIButton
alloc]
init];
XNTabBarButton
*btn
=
[[XNTabBarButton
alloc]
init];
NSString
*imageName
=
[NSString
stringWithFormat:@"TabBar%d",
i
+
1];