uisegmentedcontrol

UISegmentedControl text with multiple lines

≯℡__Kan透↙ 提交于 2019-12-06 05:47:29
问题 Is there any possibility to make UISegmentedControl with multiple lines of text in iOs 9+? So far i've tryed: Variants from SO topics: This, this and this one Make an extension: extension UISegmentedControl { func makeMultiline(numberOfLines: Int) { for segment in self.subviews { let labels = segment.subviews.filter { $0 is UILabel } // [AnyObject] labels.map { ($0 as UILabel).numberOfLines = numberOfLines } } } } Inherit from UISegmentedControl and set new class to SegmentedControl in

UISegmentedcontrol to switch views in UITabbarcontroller

ぐ巨炮叔叔 提交于 2019-12-06 05:34:53
I am trying to switch between multiple different views using a UISegmentedControl . I found a really good example to do this in: http://redartisan.com/2010/6/27/uisegmented-control-view-switching-revisited However, I need to use a UITabbarController in my app. So the navigation controller is not available for me in the app delegate. Is there any other way to switch views in a UITabbarController using UISegmentedControl ? First, consider whether you really want to do this. UITabBarController already gives you the ability to switch views, using the tab bar. If you really want to do this for some

UISegmented Control - setting the tint color of each segment

强颜欢笑 提交于 2019-12-06 01:11:38
I have been wanting to apply different colors to my UISegmentedControl segments. Many people on here have been asking how to set tint color when you press on a certain segment. What i want to do is to set the tint color of each segment throughout the life of the application(or when the view appears on the screen). Scanning the questions on here, different people have pointed out that evidently in iOS 6 you cannot set the tintColor of each segment as such: - (void)viewDidLoad { [super viewDidLoad]; buttonNames = [NSArray arrayWithObjects:@"Red", @"Green", @"Blue", nil]; colorControl = [

How do I add a UISegmentedControl to my UIToolbar using Storyboard?

梦想与她 提交于 2019-12-05 21:28:12
I'm trying to add a Segmented Control to my UIToolbar below, but when I try to drag it over in Storyboard it replaces my Table View. Also, when I try to add UIBarButton to my Toolbar it pushes my Prototype Cells down... do I have my views hierarchy wrong? When I add a UIBarButton item anyway, in the simulator the toolbar is not Black Transparent as I set in my navigation control inspector. Whats up with that? thanks! Phillip 1 - Do it programmatically. You need to assign a frame to your UIToolbar first, then you can add elements in it (the segmentedControl). I suggest though to use

UISegmentedControl not updating view

流过昼夜 提交于 2019-12-05 21:14:13
I am building an app in Xcode 5, and I ran into some strange behavior of UISegmentedControl . first some info on the app i'm building: I'm building an app in which I want to allow users to order products at registered companies. As an extra service, I want to allow them to see the orders they did, and even to filter the orders on their status: All orders, Active orders & Delivered orders. the orders are displayed in a UITableView, and I created a UISegmentedControl inside the header view to filter the orders. when the selectedSegmentIndex of that UISegmentedControl changes, it executes an

Customize UISegmentedControl on iOS 8

我的未来我决定 提交于 2019-12-05 20:39:29
iOS 7 and 8 seem to make the old ways of customizing UISegmentedControl not work entirely. I've been setting the divider images and everything like I always have in the past, but it appears that there are some new states that didn't exist in previous iOS versions, and as a result there are some weird visual effects. Here's the code that I'm using // Set divider images self.setDividerImage(UIImage(named: "SegmentedControlNoneSelected"), forLeftSegmentState: .Normal, rightSegmentState: .Normal, barMetrics: .Default) self.setDividerImage(UIImage(named: "SegmentedControlRightSelected"),

UISegmentedControl.noSegment stopped working with Xcode 11, iOS 13 [duplicate]

旧街凉风 提交于 2019-12-05 20:37:43
This question already has an answer here: Specifying UISegmentedControlNoSegment to UISegmentedControl's selectedSegmentIndex has no Effect on iOS 13 3 answers I've had two segmented controls stacked on top of each other, each with two options, so there's a 2x2 grid of filtering options for a search field. This has worked fine, but I just updated to Xcode 11 and UISegmentedControl.noSegment has stopped working when I try to update it in response to user selection. However, it works when I set the initial value to .noSegment in the property observer. isMomentary is set to false. The outlets are

Text Alignment issue when I set the custom font

我是研究僧i 提交于 2019-12-05 18:22:40
问题 When I set the custom font for the segmented control then it changes the vertical text alignment. I am using below code to set the font . // I dont think these lines are creating any issue but just wanted to paste all the code self.segmentType.layer.borderColor = navigationTintColor.CGColor; self.segmentType.layer.cornerRadius = 0.0; self.segmentType.layer.borderWidth = 1.5; // These are the lines that are changing the text alignment UIFont *font = [UIFont fontWithName:ftHelveticaNeueLTPro_Th

removing the white gradient from UISegmentedControl

僤鯓⒐⒋嵵緔 提交于 2019-12-05 07:54:28
问题 How do i get rid of, or change the white gradient within UISegmentedControl (Bar style)?? 回答1: The only way i found is to draw a layer over every segment. the bad news is that then you have to colorize by yourself the selected segment every time it changes (and "decolonizee" the unselected) the good news is that you can have many different sets of colors for every single segment and display a red near a green near a blue... you can call your method when a segmentedControl change: - (IBAction

Segmented Control set attributed title in each segment

旧巷老猫 提交于 2019-12-05 02:06:37
问题 Actually i have a segmented control with 4 segment. I need to add attributed text in each segment like "Notification (2)". Here (2) will be in different color and Notification will be in different color. I have search some third party library , But it doesn't work for me Thanks & Regards 回答1: There is limitation to use attributed text as we use for label or button. But you may try below method to achieve your requirements. -(void)SetSegmentValue:(NSString *)value forSegment:(int)index