码迷,mamicode.com
首页 > 其他好文 > 详细

美团项目(纯代码)

时间:2016-02-18 19:52:13      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:

一.框架搭建

1.icon

规格要求可从文档中查找,搜索app icon.

 

2.因为很多界面重复利用,所以不用storyboard

a.删除stroyboard,在设置中Info -> Main storyboard file base name 项直接去除

 

b.创建ZXHomeViewController(UICollectionViewController)和ZXNavigationController(UINavigationController)

 

c.在AppDelegate的didFinishLaunchingWithOptions添加:

    self.window = [[UIWindow alloc] init];
    self.window.frame = [UIScreen mainScreen].bounds;
    self.window.rootViewController = [[ZXNavigationController alloc] initWithRootViewController:[[ZXHomeViewController alloc] init]];
    [self.window makeKeyAndVisible];

 

 d.在ZXHomeViewController中添加

- (instancetype)init
{
    UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
    return [self initWithCollectionViewLayout:layout];
}

e.创建文件ZXConst.h来放全局的东西

 

f.ZXHomeViewController设置背景颜色

    // self.view == self.tableView
    // self.view == self.collectionView.superview
    // 设置背景色
    self.collectionView.backgroundColor = ZXGlobalBg;

g.设置导航栏内容

+ (void)initialize
{
    UINavigationBar *bar = [UINavigationBar appearance];
    [bar setBackgroundImage:[UIImage imageNamed:@"bg_navigationBar_normal"] forBarMetrics:UIBarMetricsDefault];
 
 
 

美团项目(纯代码)

标签:

原文地址:http://www.cnblogs.com/zhongxuan/p/5199016.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!