0
下面的代码是在iOS 6中做工精细定制没有工作,但在IOS 7UISegmentControl在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;
}
}
}
标签的颜色呈蓝色,但指数的时候选择一个代码工作不工作。
iOS7的层次结构发生了变化,因此请在此处打个分,并检查UISegmentControllView的子视图和超级视图,并根据视图层次结构自定义所需的子视图。 –