Giter Club home page Giter Club logo

scsidebarcontroller's Introduction

如何使用-SCSideBarController

icon

####创建新类, 导入主头文件并继承

#import "SCSideBarController.h"
@interface ViewController : SCSideBarController
@end

1.实例化一些控制器, 并添加为当前类的子控制器

UIViewController *vc = [[UIViewController alloc] init];
[self addChildViewController:vc];

2.如果需要设置标题和icon,则需要设置子控制器的tabBarItem属性

vc.tabBarItem.title = @"首页";
vc.tabBarItem.image = [UIImage imageNamed:@"xxx"];

3.如果需要设置文字的属性,可调用tabBarItem的setTitleTextAttributes方法 (目前支持设置字体大小和selected状态下和normal状态下的字体颜色)

[vc.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor orangeColor]} forState:UIControlStateSelected];

4.也可通过tablew代理方法自定义cell来自定义菜单栏, 但在选中cell时候需要调用swichViewController:来切换控制器

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [self switchViewController:(int)indexPath.row];
}

scsidebarcontroller's People

Contributors

sichenhz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.