这是我的代码:
UISegmentedControl* scTopNav = [[UISegmentedControl alloc] initWithItems:[[NSArray alloc] initWithObjects:@"Show Comparison", @"Estimated Annual Units", nil]];
[scTopNav setFrame:CGRectMake((self.view.frame.size.width/2)-(scTopNav.frame.size.width/2), vUserInputs.frame.origin.y + vUserInputs.frame.size.height + 50.0, scTopNav.frame.size.width, scTopNav.frame.size.height)];
[scTopNav addTarget:self action:@selector(navOptions:) forControlEvents:UIControlEventValueChanged];
scTopNav.segmentedControlStyle = UISegmentedControlStylePlain;
[self.view addSubview:scTopNav];
[self.view bringSubviewToFront:scTopNav];
触摸时控件不会突出显示,也不会调用 navOptions 方法。有什么想法可能是错的吗?