uisegmentedcontrol

UISegmentedControl, UIToolbar and UINavigationItem

二次信任 提交于 2020-01-12 13:41:46
问题 I've create a UISegmentedControl and successfully attached it to my navigationItem.tableView. But when I try instead to attach it to a UIToolbar, it blows up. I'm sure I've seen UISegementedControls on toolbars before - but can't seem to get it working. Thoughts? // works NSArray *statusItems = [[NSArray alloc] initWithObjects:@"one", @"two", nil]; statusSegments_ = [[UISegmentedControl alloc] initWithItems:statusItems]; self.navigationItem.titleView = statusSegments_; // doesn't work NSArray

UISegmentedControl with square corners

陌路散爱 提交于 2020-01-12 03:10:43
问题 I would like to modify UISegmentedControl with a subclass to remove the rounded corners. I can't seem to set the cornerRadius. Making the SegmentedControl wider than the screen (and therefor "chop" off the corners) is not an option since I have 4 or 5 segments and they would then vary in size. Is there a way to do this? Thanks 回答1: You can set the width of the segments (using setWidth:forSegmentAtIndex:) so you can easily make the left and right end segments larger (say 10px larger) than the

Segmented Controller background grey after iOS13

柔情痞子 提交于 2020-01-11 13:36:05
问题 I'm currently having problems with an iOS 13 segmented controller. I have this method in which I change the appearance of my segmented controller, it worked great until iOS 13 got out. now I the segmentedController has a grey background always, even if I set the background color to white, or black or whatever. What Can I do? - (void)modifySegmentedControl{ if (@available(iOS 13.0, *)) { [_segmentedControl setBackgroundColor:UIColor.clearColor]; [_segmentedControl setSelectedSegmentTintColor

UISegmentedControl iOS 13 clear color

南楼画角 提交于 2020-01-10 16:15:46
问题 On iOS 12, to get a UISegmentedControl with clear border, clear divider line, everything clear was easy. All I did was this: settingControl.tintColor = .clear let font = myFont let boldfont = myBoldFont settingControl.setTitleTextAttributes([NSAttributedString.Key.foregroundColor : UIColor.white, NSAttributedString.Key.font:font], for: .normal) settingControl.setTitleTextAttributes([NSAttributedString.Key.foregroundColor : UIColor.red, NSAttributedString.Key.font:boldfont], for: .selected)

iphone ios7 segmented UISegmentedControl change only border color

天大地大妈咪最大 提交于 2020-01-10 09:03:26
问题 Been looking around and trying to change just the border color (with a different text color) with no luck. Can change the tint, but changes both the text and border. 回答1: You can use UIAppearance proxy to set title text attributes but preserve tintColor for borders. Something like: [[UISegmentedControl appearance] setTitleTextAttributes:@{ NSForegroundColorAttributeName : [UIColor redColor] } forState:UIControlStateNormal]; Edit: To tint images, you can use something like this in category on

Switch between UIViewControllers using UISegmentedControl

馋奶兔 提交于 2020-01-10 04:34:27
问题 I have a tabbar -> navigationcontroller structure. In one of these tabs, I want to switch between two UIViewControllers (a KalViewController and a UITableViewController to be be exact), using a UISegmentedControl located in the Navigation Bar. Currently, I have a third UIViewController, that pops and pushes the appropriate ViewControllers on segment value change. I don't think thats the right way to do it and it also destroys the navigation stack (when I tap on the bar item, the navigation

UISegmentedControl register taps on selected segment

风格不统一 提交于 2020-01-09 06:04:33
问题 I have a segmented control where the user can select how to order a list. Works fine. However, I would like that when an already selected segment is tapped, the order gets inverted. I have all the code in place, but I don't know how to register the taps on those segments. It seems the only control event you can use is UIControlEventValueChanged, but that isn't working (since the selected segment isn't actually changing). Is there a solution for this? And if so, what is it? Thanks in advance!

Constraints Removing SegmentController from view

℡╲_俬逩灬. 提交于 2020-01-07 08:35:43
问题 I have a UICollectionView and a SegmentController . The required end result: SegmentController fully in view, UICollectionView beneath it Before adding constraints: After adding constraints (Notice the SegmentController is almost entirely hidden): The Constraints added: ProductsCollection.removeConstraints(ProductsCollection.constraints) SegmentController.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ SegmentController.centerXAnchor.constraint(equalTo: view

Switching to different UITableViewControllers with UISegementedControl

江枫思渺然 提交于 2020-01-06 16:21:31
问题 I've an UINavigationViewController with an UISegmentedControl in the navigation bar. I want to achieve a simple switching to different ViewControllers when users push on the segmented control. I've tried a lot and nothing works... Considered sources: MonoTouch Instantiating a ViewController programmatically for ContainerView https://stackoverflow.com/search?q=viewcontroller+intptr+handle And a lot of google research... The whole project is storyboard based! Any solutions which targets NIB's

Switching to different UITableViewControllers with UISegementedControl

烂漫一生 提交于 2020-01-06 16:19:18
问题 I've an UINavigationViewController with an UISegmentedControl in the navigation bar. I want to achieve a simple switching to different ViewControllers when users push on the segmented control. I've tried a lot and nothing works... Considered sources: MonoTouch Instantiating a ViewController programmatically for ContainerView https://stackoverflow.com/search?q=viewcontroller+intptr+handle And a lot of google research... The whole project is storyboard based! Any solutions which targets NIB's