一.框架搭建
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];
}