如何解决即使在 ios 14 中,Segment Control 也不起作用或不触发任何
我在目标 C 中以编程方式创建了 UISegment 控件。它在 ios 12-13.2 中运行良好,但在 ios 14 中突然停止工作。有人可以告诉我在 ios 14 中进行分段控制的方法是什么。
CGRect segmentCtrlFrame = CGRectMake(20,20,[UIScreen mainScreen].bounds.size.width - 40,30);
UISegmentedControl *appUsageSegmentCtrl = [[UISegmentedControl alloc]initWithItems:self.appUsageOptionsArray];
appUsageSegmentCtrl.frame = segmentCtrlFrame;
[appUsageSegmentCtrl setTintColor:SEGMENT_CONTROL_COLOR];
[appUsageSegmentCtrl addTarget:self action:@selector(appUsageChanged:) forControlEvents:UIControlEventValueChanged];
[cell addSubview:appUsageSegmentCtrl];
cell.selectionStyle = UITableViewCellSeparatorStyleNone;
appUsageSegmentCtrl.selectedSegmentIndex = self.selectedAppUsage;
if (@available(iOS 13,*)) {
[appUsageSegmentCtrl setSelectedSegmentTintColor:SEGMENT_CONTROL_COLOR];
}
[appUsageSegmentCtrl setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor blackColor]} forState: UIControlStateSelected];
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。