uisegmentedcontrol

How to switch between UITabBarController programmatically

这一生的挚爱 提交于 2020-01-25 09:04:21
问题 I have an application with UITabBarController, where the first tab contains a ViewController of an HomePage. What I have to do, is to switch between the tabs (this is pretty simple: [[self tabBarController] setSelectedIndex:index]), AND to navigate through outlets of the selectedTab from the "HomePage". Just to explain myself: TabElement1--->TabElementX---->UISegmentedController:segmentY The problem is that the UISegmentedController is nil because it is not initialized yet (at least the first

UINavigationBar with UISegmentedControl partially covers childViews

心已入冬 提交于 2020-01-21 05:55:06
问题 I have read many other threads on this and the Apple docs, but haven't found a solution yet for my particular problem. My app uses a UITabBarController as the rootViewController , and in one of the tabs I have a UISegmentedControl in the navigationBar to switch between three child UITableViewController s. (In the real app two of the childVCs are a custom UIViewController , I'm just using three UITableViewController s for the sample app). The segmentedControl setup and the switching all works

UISegmentedControl with Badge or Highlighting

二次信任 提交于 2020-01-17 01:40:49
问题 Occasionally I want to highlight one of segments of a UISegmentedControl , i.e. the third title is "News" and I want to draw user's attention to it. Ideally with a red badge with a number as on the UITabBar - any idea how to achieve this? Feel free to share other ideas as well. I thought about adding the badge as an image just on top of it, but maybe there is some better way. 回答1: I wouldn't have thought there is a better way to be honest. The easiest way will be (probably) to subclass

How to set individual segment color in uisegmentedcontrol?

无人久伴 提交于 2020-01-16 18:37:08
问题 I'm using the following code - (void)viewWillAppear:(BOOL)animated ....... [[self.controlStatus.subviews objectAtIndex:2] setTintColor:[UIColor greenColor]]; [[self.controlStatus.subviews objectAtIndex:1] setTintColor:[UIColor orangeColor]]; [[self.controlStatus.subviews objectAtIndex:0] setTintColor:[UIColor redColor]]; ......... But this code is not working always . Sometimes the index changes and 1st segment stays green or orange. I don't know whats happening !! Can anyone help me ? 回答1:

iOS 7 - UISegmentedControl not staying highlighted?

眉间皱痕 提交于 2020-01-15 05:20:06
问题 I have a UISegmentedControl that is being displayed within my UINavigationBar on an iPhone app running iOS 7. I've noticed that when I select one of the values in the UISegmentedControl the highlighting does not stay active. That is, if I select the first item, it triggers the action that I have added to it, but immediately un-highlights the value I selected. Is this expected behavior? A bug? I don't recall ever seeing this in other apps using this control, and it works just fine on iOS 6.

How to set the ios13 UISegmentedControl backgroundColor to white?

白昼怎懂夜的黑 提交于 2020-01-14 10:43:36
问题 I am trying to set the background color of a segmentedControl in iOS 13 for the normal state. I have the same issue as listed here: How to set backgroundColor of UISegmentedControl to white in iOS 13 The answer to the question in the link above is not helpful. I would like to maintain the ios13 slide animation behavior but also have the normal state segments to be white not a light gray. There seems to be a default image in the segmentedControl that is causing the gray/offWhite coloring

UISegmentedControl selected index always 0?

给你一囗甜甜゛ 提交于 2020-01-14 09:22:12
问题 I have a UISegmentedControl that has 6 segments which I created in Interface Builder. I am calling the following method on value changed: -(IBAction)segmentedChartButtonChanged:(id)sender { switch (self.segmentedChartButton.selectedSegmentIndex) { case 0: NSLog(@"5d selected. Index: %d", self.segmentedChartButton.selectedSegmentIndex); break; case 1: NSLog(@"3m selected. Index: %d", self.segmentedChartButton.selectedSegmentIndex); break; default: break; } } Whenever I change the segments, the

UISegmented Control - setting the tint color of each segment

妖精的绣舞 提交于 2020-01-13 19:10:55
问题 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

UISegmented Control - setting the tint color of each segment

白昼怎懂夜的黑 提交于 2020-01-13 19:08:11
问题 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

Use of unimplemented initializer 'init(frame:)' for class when instantiating a subclass of UISegementedControl

倾然丶 夕夏残阳落幕 提交于 2020-01-13 07:18:09
问题 I'm getting the following error when I try to use an instance of MySegmentControl in the code below. The error occurs right after the app is being launched. Any idea what am I missing? Fatal error: Use of unimplemented initializer 'init(frame:)' for class 'TestingSubclassing.MySegmentControl' Subclass of UISegementedControl import UIKit class MySegmentControl: UISegmentedControl { init(actionName: Selector) { let discountItems = ["One" , "Two"] super.init(items: discountItems) self