繁体   English   中英

UISegmentControl自定义在iOS 7中不起作用

[英]UISegmentControl customize not working in ios 7

下面的代码在ios 6中工作正常,但在ios 7中不工作

for (id segment in [cell.m_CtrlSegment subviews]) {

            for (id label in [segment subviews]) {

                if ([label isKindOfClass:[UILabel class]]) {

                    UILabel *titleLabel = (UILabel *) label;

                    //inserting line here, to make the frame behave nicely:
                    //
                    titleLabel.frame = CGRectMake(0, 0, (cell.m_CtrlSegment.frame.size.width/DownloadCount)-4,40);
                    titleLabel.textColor = [UIColor blackColor];
                    titleLabel.backgroundColor = [UIColor clearColor];
                    titleLabel.font = [UIFont systemFontOfSize:12];
                    titleLabel.textAlignment = UITextAlignmentCenter;
                    titleLabel.lineBreakMode = UILineBreakModeWordWrap;
                    titleLabel.shadowColor = [UIColor darkGrayColor];
                    titleLabel.numberOfLines = 0;

                }
            }
        }

标签的颜色保持为蓝色,但是当选择其中一个索引时,代码将起作用。

您实际上不应该使用此类黑客,因此您的应用可能会被拒绝

2.5

我们还发现,您的应用程序与提供的视图的内部层次结构(即一个私有实体)的组织和布局交互。 与私人实体进行互动不符合《 App Store审查指南》。

当涉及到自定义功能时, 外观代理是最好的,并且可以从iOS5获得。

在您进行实验时,依赖这种层次结构的黑客也可能会在将来的iOS中被破解。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM