xcode - iOS 7UITabbarController 自定义tabbar高度与内容view高度
大家讲道理
大家讲道理 2017-04-17 11:55:27
[iOS讨论组]

如题,iOS 7怎样实现内容view的高度调整?沿用iOS 6的方法是不行的

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

全部回复(1)
伊谢尔伦

请问你是想自定义 tabbar 的高度还是想调整 content view 的高度? 你可以使用下面的方法来打印出 UITabBarController 的 View 的子视图信息来查看视图层级的布局:

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    [self printViewHierarchy:self.tabBarController.view];
}

- (void)printViewHierarchy:(UIView *)superView
{
    static uint level = 0;
    for(uint i = 0; i < level; i++){
        printf("\t");
    }

    const char *className = NSStringFromClass([superView class]).UTF8String;
    const char *frame = NSStringFromCGRect(superView.frame).UTF8String;
    printf("%s:%s\n", className, frame);

    ++level;
    for(UIView *view in superView.subviews){
        [self printViewHierarchy:view];
    }
    --level;
}

结果如下:

UILayoutContainerView:{{0, 0}, {320, 480}}
    UITransitionView:{{0, 0}, {320, 480}}
        UIViewControllerWrapperView:{{0, 0}, {320, 480}}
            UIView:{{0, 0}, {320, 480}}
    UITabBar:{{0, 431}, {320, 49}}
        _UITabBarBackgroundView:{{0, 0}, {320, 49}}
            _UIBackdropView:{{0, 0}, {320, 49}}
                _UIBackdropEffectView:{{0, 0}, {320, 49}}
                UIView:{{0, 0}, {320, 49}}
        UITabBarButton:{{2, 1}, {156, 48}}
            UITabBarSwappableImageView:{{54, 2}, {48, 32}}
            UITabBarButtonLabel:{{68, 35}, {21, 12}}
        UITabBarButton:{{162, 1}, {156, 48}}
            UITabBarSwappableImageView:{{54, 2}, {48, 32}}
            UITabBarButtonLabel:{{60, 35}, {36, 12}}
        UIImageView:{{0, -0.5}, {320, 0.5}}
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号