uisegmentedcontrol

Text in UISegmentedControl not exactly centered?

最后都变了- 提交于 2020-01-06 08:25:14
问题 Maybe it's just me, but it seems like the bottom padding is greater than the top padding for the text in this UISegmentedControl . Why is this happening? 回答1: The position is probably correct, but it looks wrong to your eye because room is left for a descender, and there are no descenders because the titles are all caps. Luckily, you can adjust the y -component of the content position! There are two ways: In Interface Builder, in the attributes inspector for each segment, set the Content

UIsegmentedControl setTintColor strange behaviour

南楼画角 提交于 2020-01-06 04:33:15
问题 I have a UISegmentedControl containing 3 options for selecting map type. I am setting tintcolor as black as default and I want to set green color for selected segment. Here is declaration of segmented control NSArray *mapType = [NSArray arrayWithObjects: @"Map", @"Hyb", @"Sat", nil]; segmentedMapType = [[UISegmentedControl alloc] initWithItems:mapType] ; segmentedMapType.segmentedControlStyle = UISegmentedControlStyleBar ; segmentedMapType.tintColor = [UIColor blackColor]; segmentedMapType

UIImageView.appearance is overriding UISegmentedControl.appearance

♀尐吖头ヾ 提交于 2020-01-05 01:08:11
问题 I've been trying to use the appearance proxy API to apply some default colors to some controls, but I've run into a problem. When I apply a tint color to UISegmentedControl using something like... UISegmentedControl.appearance().tintColor = UIColor.red It generates this... All good, but when I add... UIImageView.appearance().tintColor = UIColor.green it changes to... Just to be clear, I have BOTH this lines in my code UISegmentedControl.appearance().tintColor = UIColor.red UIImageView

Customize UISegmentedControl on iOS 8

女生的网名这么多〃 提交于 2020-01-02 07:31:15
问题 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,

How to set UISegmentedControl Tint Color for individual segment

天涯浪子 提交于 2020-01-01 05:04:32
问题 Starting to learn Swift and am attempting to convert this ObjectiveC code: [[mySegmentedControl.subviews objectAtIndex:0] setTintColor:[UIColor blueColor]] This correctly sets the tint color of the first segment. This is the closest I've come to getting a Swift version of the same code: mySegmentedControl?.subviews[0].tintColor = UIColor.blueColor() The error I get is '@Ivalue $T9' is not identical to 'UIColor!!' I don't understand what this error means. When I look at the .tintColor method

How to set backgroundColor of UISegmentedControl to white in iOS 13

淺唱寂寞╮ 提交于 2020-01-01 04:58:06
问题 iOS 13 introduced some changes to the UISegmentedControl including a really nice animation when switching the selected segment. However I'm noticing that it's not displaying the backgroundColor property correctly, it always seems to have a bit of a tint to it. I've seen questions that answer how to set the selectedSegmentTintColor and such but I'm struggling to set the backgroundColor to say .white , no matter what I do it always shows up a bit of a gray even though there's no tintColor or

UISegmentedControl custom background image

雨燕双飞 提交于 2020-01-01 04:50:11
问题 I have UINavigationBar setup as image - some wood texture. I want to insert UISegmentedControl with 4 buttons on that bar. Buttons should have same texture with slightly changed tint. One solution would be to change tint alpha of buttons background color, so that texture in background can get trough, but as I set alpha for tint in IB it doesn't save value, it always gets back to value 1. I cant get UISegmentedControl to show background image, so finally gave up and decide to search for help..

Scope Bar for UITableView like App Store?

强颜欢笑 提交于 2019-12-31 13:27:09
问题 Does anyone know how to add a scope bar to a UITableView ? The App Store app does this sometimes, like in the picture below. I would like to use this scope bar to add sorting options for the elements in the UITableView . This would be more convenient than having a toolbar with a UISegmentControl . I just don't know how to implement this. I don't even know the name of the element (I'm calling it scope bar because it looks just like the scope bar of a UISearchBar , but it is not). 回答1: The

Passing Data to view controllers that are embedded in container views

我是研究僧i 提交于 2019-12-30 04:59:10
问题 I have view controllers that just need to get passed a NSDictionary called "otherUser". I am using a segmented controller to conveniently present 4 of these views to a user using container views. I know all of these views will be loaded at the same time and will stay loaded, which is what I want even though the toll on memory. I know how to directly pass this value to the view controller but don't know how to pass it to a view controller that would then spread it to 4 views to load the same

How do I set the accessibility label for a particular segment of a UISegmentedControl?

左心房为你撑大大i 提交于 2019-12-28 16:36:45
问题 We use KIF for our functional testing, and it uses the accessibility label of elements to determine where to send events. I'm currently trying to test the behaviour of a UISegmentedControl, but in order to do so I need to set different accessibility labels for the different segments of the control. How do I set the accessibility label for a particular segment? 回答1: I'm just getting started with KIF myself, so I haven't tested this, but it may be worth a try. I'm sure I'll have the same issue