uisegmentedcontrol

Change UISegmentedControl selected index or value programmatically

蹲街弑〆低调 提交于 2019-12-06 17:12:33
问题 I have a UISegmentedControl with two segments (index: 0 and 1) that I am trying to reset programmatically to 0. When I run the command below it does not reset the segment index to 0 as expected. Instead it highlights segment indexed 1. [seg setSelectedSegmentIndex:0]; Oddly when I log the selected segment, it returns 0 . NSLog(@"seg setSelectedSegmentIndex %d", seg.selectedSegmentIndex); Also oddly, after running setSelectedSegmentIndex:0 I cannot reselect segment 0 manually by touch, it

Swift handle action on segmented control

拜拜、爱过 提交于 2019-12-06 16:36:38
问题 I have a HMSegmentedControl with 4 segments. When it is selected, it should pop up view. And when the pop up dismissed, and trying to click on same segment index it should again show the pop up. By using following does not have any action on click of same segment index after pop up dissmissed. segmetedControl.addTarget(self, action: "segmentedControlValueChanged:", forControlEvents: UIControlEvents.ValueChanged) 回答1: You set your target to fire just when the value change, so if you select the

Segmented control, change tint opacity, but not border

拟墨画扇 提交于 2019-12-06 16:23:10
In Swift , how do I change the tint opacity of the selected index, but not the border of the whole control? This changes the color and opacity of the whole control: sessionTypeSegmentedControl.tintColor = UIColor(red: 140/255, green: 140/255, blue: 140/255, alpha: 0.1) Followed by this I tried: sessionTypeSegmentedControl.layer.borderColor = UIColor(red: 0/255, green: 0/255, blue: 0/255, alpha: 1.0).cgColor But this has no effect on the border. EDIT: I want to change the blue background color opacity shown in this image. On the far left. http://i.stack.imgur.com/GgUwN.png So the expected

How to add content view in segment control in xamarin forms

随声附和 提交于 2019-12-06 15:25:43
I have to implement a content view in segment control. This is the UI I have to implement As you can see there is two content view that is VENDOR NAME and PRODUCT/SERVICE. I followed this example and implemented it in iOS but in android, it's just a blank app. This is my XAML code. <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:SegmentedApp" x:Class="SegmentedApp.SegmentedAppPage" > </ContentPage> This is the code behind public partial class SegmentedAppPage : ContentPage { SegmentedControl segControl

Passing UISegmentedControl values from FlipSideViewController in an Utility application to the mainviewcontroller…

只谈情不闲聊 提交于 2019-12-06 15:09:45
问题 For example, I want the maptype in the Mainviewcontroller to change from satellite to hybrid if the segmentedcontrol in the flipsideviewcontroller changes? What am i doing wrong? Basically, I want the mainviewcontroller to react to the changes made in the flipsideviewcontroller!!! FlipsideViewController.h #import <UIKit/UIKit.h> #import <MapKit/MapKit.h> #import <MapKit/MKMapView.h> @protocol FlipsideViewControllerDelegate; @interface FlipsideViewController : UIViewController { id

iOS 6 UISegmentedControl with iOS 7 design

眉间皱痕 提交于 2019-12-06 13:23:07
I'm working on an app that's supposed to work on both iOS 6 and iOS 7, and have the same flat design for both. I'm trying to customize my UISegmentedControl to have borders, corner radius and all, but I can't figure out how to do so. I've only mange to have a flat background so far. Does anyone have any advice to have an iOS 6 UISegmentedControl look like an iOS 7 one ? EDIT : I would like to have instead of Ashutosh You can use below code: // To set colour of text NSDictionary *attributes = [NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:UITextAttributeTextColor];

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

不问归期 提交于 2019-12-06 12:13:35
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 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 can also customize the text using -setTitleTextAttributes:forState: . These methods can be found in the

make an uisegmentedcontrol in an uiscrollview

假装没事ソ 提交于 2019-12-06 11:59:53
I want to use a very large segmentedcontrol component so I had the idea to make it in a uiscrollview ..so by scrolling horizontally user can choose the appropriate item. I wrote this code: CGRect rect = [[UIScreen mainScreen] applicationFrame]; CGRect frame = CGRectMake(rect.origin.x + kLeftMargin, rect.size.height - kPaletteHeight - kTopMargin, 2*rect.size.width , kPaletteHeight); seg.frame = frame; scroll.frame = frame; scroll.contentSize = CGSizeMake(frame.size.width * 2,frame.size.height); scroll.showsHorizontalScrollIndicator = YES; scroll.showsVerticalScrollIndicator = NO; scroll

Multiple selection of segments in UISegmentedControl

落花浮王杯 提交于 2019-12-06 10:07:40
Can the UISegmentedControl allow multiple selection of segments? Otherwise should we create custom controls? By default, UISegmentedControl does not support multiple selection. For such a case, a custom control should be the desired solution; I would recommend to check ATHMultiSelectionSegmentedControl library, it does provided the desired behavior of what are you looking for, it is easy to use and now it is compatible with the latest Swift version (which is 3 at the time I posted my answer). 来源: https://stackoverflow.com/questions/35215378/multiple-selection-of-segments-in-uisegmentedcontrol

Weird interface bug UIScrollView in UITabBarController. Reproducible by others?

假如想象 提交于 2019-12-06 06:24:59
问题 I get a weird interface bug with my UIScrollView and I cant figure out how to solve it. I only wrote one line of code (shown below) and it is a blank project's setup easily reproducible ! Setting: I have a UIScrollView that contains a UISegmentedControl (since the segments of the control are loaded dynamically, it could exceed the width of the screen and the scrollView is supposed to scroll the segmentedControl horizontally, the height of the scrollview is the same as the UISegmentedControl's