uisegmentedcontrol

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

青春壹個敷衍的年華 提交于 2019-12-28 16:35:31
问题 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

Different ViewController if different selectedSegmentIndex

喜你入骨 提交于 2019-12-26 08:44:12
问题 My code is @IBAction func pressedButton(_ sender: Any) { self.resignFirstResponder() if mySegment.selectedSegmentIndex == 0 { Here I need if I selected Segment #0 on ViewControllerA (and press my button) then go to ViewControllerB , if Segment #1 then ViewControllerC , if Segment #2 then ViewControllerD . Is it possible? 回答1: First wire a segue for each viewController. control -drag from the viewController icon at the top of ViewControllerA to another ViewController and select the segue type.

Different ViewController if different selectedSegmentIndex

六眼飞鱼酱① 提交于 2019-12-26 08:44:04
问题 My code is @IBAction func pressedButton(_ sender: Any) { self.resignFirstResponder() if mySegment.selectedSegmentIndex == 0 { Here I need if I selected Segment #0 on ViewControllerA (and press my button) then go to ViewControllerB , if Segment #1 then ViewControllerC , if Segment #2 then ViewControllerD . Is it possible? 回答1: First wire a segue for each viewController. control -drag from the viewController icon at the top of ViewControllerA to another ViewController and select the segue type.

Button in container view not working

泄露秘密 提交于 2019-12-25 19:05:11
问题 I built in a segmented control in Swift 4 using the TwicketSegmentedControl-Framework (find it here on GitHub). My storyboard looks like this: I added three container views – home, profile and settings –, each with a corresponding VC.swift-file, which are switched through by the segmented control. This is working well, however, any buttons implemented in one of the three views won't work, can't be pressed even. Do you have a clue why that might be? My ViewController.swift-file, in which the

dimiss modal and return to presented childViewController in containerView

此生再无相见时 提交于 2019-12-25 14:48:55
问题 I am having a bit of an issue with dismissing a modal view presented from a childviewController in a container view. I have a UINavigationController as the rootViewController (MainNavigationController), and present a modal from one of the childViewControllers from the selectedSegmentIndex 1 (secondViewController). The modal is presented fine, but when I dismiss the modal to go back to the secondViewController(a subclass of HomeController) it returns me back to selectedIndex 0, so not the

Auto Layout in Navigation Controller with UISegmentedControl: good in iOS7, bad in iOS6

左心房为你撑大大i 提交于 2019-12-25 12:09:50
问题 For a navigation controller I like to have a few controls placed in a view from top towards the bottom. I am using auto layout and added constraints, so that the views have a vertical gap to each other. This looks nice for iOS7 and iOS6 in a normal view controller, also for iOS7 in a navigation controller; but wrong in iOS6. The UISegmentedControl shows up wrong. See the screenshots. It looks like the larger height of the UISegmentedControl is not taken into account for iOS6 view. Also it

Scrolling TableView effects response time of SegmentControl

房东的猫 提交于 2019-12-25 07:47:09
问题 This may be a strange problem and I hope someone has had it before. I added a SegmentControl to my TableView using this code: UIView *headerView = [[UIView alloc] init ]; [headerView addSubview:resultsSegment]; self.tableView.tableHeaderView = headerView; resultsSegment.frame = CGRectMake(45, 123, 250, 40); [self.tableView addSubview:resultsSegment]; With help from these forums the first three lines made the Segment part of the TableView Header so that it stayed in place for scrolling. Great.

UIControlEventValueChanged not working when i tapped an already selected segment section

大憨熊 提交于 2019-12-25 04:58:11
问题 My aim is to trigger UIControlEventValueChanged delegate again when i tapped an already selected segment . So i have referred the below links uisegmentedcontrol-register-taps-on-selected-segment maintaining-selection-in-uisegmentedcontrol As per the links i have created a uisegmentedcontrol subclass , implemented the - (void) setSelectedSegmentIndex:(NSInteger)toValue { method and wrote the codes (from the above links). Its worked fine with Ipad1. However the setSelectedSegmentIndex in the

UISegmentedControl - how to toggle between 2 UITableViews

三世轮回 提交于 2019-12-25 04:56:04
问题 I have a tab bar based application. What is the best way to toggle between 2 different UITableView views? Should I use a wrapper view and add those 2 views to it and depending on which segment was chosen I will show the correct view? Using only one tableView will not work because the layout is different between those 2 tableviews. Thanks 回答1: I usually take a different approach: I prefer to use different dataSources for a single instance of tableView and then switching between them (usually

Adding Constraint messed up view

大城市里の小女人 提交于 2019-12-24 18:41:17
问题 I have a view with a UICollectionView and a UISegmentedControl . I want to change constraints so the segment controller won't overlap collection view, like in this picture: This is my code : override func viewDidLoad() { super.viewDidLoad() self.navigationItem.leftBarButtonItem = nil self.tabBarController?.tabBar.isHidden = true self.SegmentController.setTitle(SegmentAtext, forSegmentAt: 0) self.SegmentController.setTitle(SegmentBtext, forSegmentAt: 1) self.view.bringSubview(toFront: