Easy 2 OC 更多 More

代码:

UIView {
    name = More;
    edges = 0;
    bgColor = #eeeeee;
    
    UIView {
        id = headView;
        top.left.right = 0;
        x-height = 88;
        height = 64;
        
        UIView {
            id = navView;
            left.right.bottom = 0;
            height = 44;
            
            UILabel {
                center = parent;
                text = "更多";
                font = 20;
            }
        }
    }
    
    UIView {
        id = contentView;
        bottom.left.right = 0;
        top = headView.bottom;
        
        UICollectionView {
            id = collectionView;
            edges = 0;
            cellSize = parent,60;
            cells = AAA,BBB,CCC,DDD,EEE,FFF;
        }
    }
}

效果:

1A893DAE-F06F-4981-91C7-4CC66EA6

头部的内容是不是看不到啊,其实不是代码的问题。
归根到底的问题在于, MainTabBar里面的设置,

tabBar {
            class = MoreController;
            baseOn = UINavigationController;
            
            title = "更多";
            image = "xxx4.png";
        }

调用了 UINavigationController,而UINavigationController 默认是有导航栏的,所以导致刚好那个范围被挡了。只需要隐藏就好了。

tabBar {
            class = MoreController;
            baseOn = UINavigationController;
            baseOnNavigationBar = hide;
            
            title = "更多";
            image = "xxx4.png";
        }

然后最终效果是~~
5996C16C-5AE1-46F6-A6DF-EF020996A766

好了看到头部的内容了~~~
AAA,BBB,CCC,DDD,EEE,FFF 分别代表了 UICollectionViewCell 的子类。

比如:

UICollectionViewCell {
    name = AAA;
    edges = 0;
    onlyCreate = view;
    bgColor = #ffffff;
    
    UIControl {
        id = theControl;
        edges = 0;
        
        UILabel {
            text = "公司简介";
            left = 15;
            centerY = parent;
            textColor = #3d3d3d;
            font = 14;
        }
        
        UIImageView {
            width = 20;
            height = 30;
            centerY = parent;
            right = -15;
            bgColor = #888c51;
        }
        
        UIView {
            left.right.bottom = 0;
            height = 1;
            bgColor = #eeeeee;
        }
    }
}

以此类推~~~
特别说明的是,
onlyCreate 可以指定是否创建view 或 controller,而指定 view的时候,默认生成的名字为 设置的值 —— name。