-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
添加简介以及用法
- Loading branch information
Showing
1 changed file
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,42 @@ | ||
自定义的Tabbar | ||
|
||
##介绍 | ||
|
||
CustomTabBar是一款自定义的Tabbar,继承UITabbarViewController,可自定义tab图片,背景,以及选中背景。 | ||
|
||
|
||
##截图 | ||
<img width="320" height="480" src="https://raw.githubusercontent.com/yhjiang/CustomTabBar/master/ScreenShot1.png"/> | ||
|
||
|
||
##用法 | ||
``` | ||
//初始化ViewController | ||
FirstViewController *home = [[FirstViewController alloc] init]; | ||
home.title = @"首页"; | ||
SecondViewController *list = [[SecondViewController alloc] init]; | ||
list.title = @"推荐"; | ||
ThirdViewController *search = [[ThirdViewController alloc] init]; | ||
search.title = @"搜索"; | ||
FourthViewController *more = [[FourthViewController alloc] init]; | ||
more.title = @"更多"; | ||
//创建导航 | ||
UINavigationController *nav1 = [[UINavigationController alloc] initWithRootViewController:home]; | ||
UINavigationController *nav2 = [[ UINavigationController alloc] initWithRootViewController:list]; | ||
UINavigationController *nav3 = [[UINavigationController alloc] initWithRootViewController:search]; | ||
UINavigationController *nav4 = [[UINavigationController alloc]initWithRootViewController:more]; | ||
//把VC放到数组中 | ||
NSMutableArray *controllers = [NSMutableArray arrayWithArray:@[nav1,nav2,nav3,nav4]]; | ||
//初始化Tabbarcontroller | ||
_tabbarController = [[YHCustomTabbar alloc] init]; | ||
_tabbarController.viewControllers = controllers; | ||
_tabbarController.selectedIndex = 0; | ||
[self.window setRootViewController:_tabbarController]; | ||
``` |