uisegmentedcontrol

Scale UISegmentedControl labels based on width of control

a 夏天 提交于 2019-12-10 17:49:55
问题 This seems like a no brainer, but I cannot find any way to do this. Basically what I have is a UISegmentedControl with two localized labels using NSLocalizedString . I have set the font size and everything looks great in English and a few other languages. But, in Japanese and other languages the characters are larger and cause the label to be truncated. self.segmentedControl = [[UISegmentedControl alloc] initWithItems: [NSArray arrayWithObjects: NSLocalizedString(@"Miles", nil)

Stretched images in UISegmentedControl

丶灬走出姿态 提交于 2019-12-10 12:37:05
问题 I'm trying to add images to my UISegmentedControl but the image is always automatically stretched to fill the entire control (see picture). I'm currently setting the image by calling setImage:forSegmentAtIndex:. How can set the image so that it maintains its aspect ratio? This seems like it should be an easy thing to do but I haven't been able to figure it out. 回答1: When setting your image, use: UIImage *myNewImage = [myOldImage resizableImageWithCapInsets:UIEdgeInsetsMake(top, left, bottom,

UISegmentedControl delegate/Touch Events

喜夏-厌秋 提交于 2019-12-10 12:30:32
问题 I have a UISegmentedControl that has six segments, I want them to call a method when the value changes, but also when each segment gets a UIControlEventTouchDragIn because I want a UILabel to show up with it's name when the person is trying to select something on it and drags their finger across the control, but the segmented control does not sen this call even when I drag into the thing. Please help. Maybe I need to create UIButtons over the control that call methods upon a drag in, but call

Swift: Segmented control behaves in a weird way in UITableView Cell

社会主义新天地 提交于 2019-12-10 12:17:26
问题 Anytime I tap segmented control in UICell, immediately some other cell gets this segmented control in the same position. It looks like segmented control recognizes that not only this particular one was tapped but also some other one in other cell. Have you ever encountered issue like this? this is my custom cell implementation: class QuestionYesNoCustomCellTableViewCell: UITableViewCell { @IBOutlet weak var questionLabel: UILabel! @IBOutlet weak var segmentControl: ADVSegmentedControl!

How to create Segmented control with underline in iOS [duplicate]

跟風遠走 提交于 2019-12-10 10:47:24
问题 This question already has answers here : Custom UISegmentedControl (10 answers) Closed 3 years ago . How to create Segmented control with underline in iOS (like on image on the left)? As far as I understood it's similar to Android native control. Thank you 回答1: UISegmentedControl includes API for customizing it's appearance. You set images for various state combinations using -setBackgroundImage:forState:barMetrics: and -setDividerImage:forLeftSegmentState:rightSegmentState:barMetrics: . You

Segmented control on top of a table view, not in the title view though

只谈情不闲聊 提交于 2019-12-09 06:54:55
问题 How can I put a segmented control on top of a tableview. I don't want it on the title view of the navigation controller and I don't want it to scroll with the tableview either. For reference of what I mean, please look at App Store app, choose Categories, then select any category. There you will see the segmented control I'm looking for. The one with 'Paid', 'Free', and 'Release Date' segments. I'm using the code not IB, so if you know how please answer this with code not IB drag and drop.

How to Add Content Page to Segment Control in IOS Xamarin.Forms

笑着哭i 提交于 2019-12-09 03:26:55
问题 I have used Segmented Control in my application. I don't know how to add two content pages to Segment control like a tabbed page. I have attached the sample file. Please give any suggestion Link for Sample Application Sample Code: public partial class SamplePage : ContentPage { SegmentedControl segControl; SegmentedControlOption optionOne; SegmentedControlOption optionTwo; public SamplePage() { segControl = new SegmentedControl(); optionOne = new SegmentedControlOption(); optionTwo = new

UISegmentedControl only changes text color when revisiting ViewController

有些话、适合烂在心里 提交于 2019-12-08 23:56:41
问题 UPDATE ANSWERED. BY ME. Currently having problems with the text color change of my UISegmentedControl ; it needs to change on first load with UIControlStateSelected . Code works, but only conditionally. It works when you visit the page with the segmented control on the navigation bar, hit the back button, and then visit the page again. I'm assuming there's a problem with inheritance here. Let me explain.. The location of the the segmented control lies on top of my navigation bar. Inheritance

UISegmentedControl Within UIToolBar

久未见 提交于 2019-12-08 19:45:52
问题 I know how to add a UISegmentedControl to a UIToolBar from within IB, but I am trying to do the same programmatically, because I am using a custom subclass of UISegmentedControl with doesn't have an XIB. This is the code for the UISegmentedControl : SVSegmentedControl *navSC = [[SVSegmentedControl alloc] initWithSectionTitles:[NSArray arrayWithObjects:@"List", @"Calendar", nil]]; navSC.delegate = self; [self.view addSubview:navSC]; [navSC release]; navSC.center = CGPointMake(160, 70); I was

UISegmentedControl wrong dividerImage

大兔子大兔子 提交于 2019-12-08 13:00:10
问题 I am custumizing all segmented controls in my app with the following code.Initially I set the selected segment to index 2. Everything works perfect in IOS 6.While I was testing the app on IOS5, I realised that the initial setting of segmented control had a bug.The separation image between selected and unselected state is not set right.Due to that it looks like this. If i change the selected segments by tapping the segmentedcontrol behaves normal.It is very weird.What elsse shall i do to