Tag: uisegmentedcontrol

带有方向或箭头主题的UISegmentedControl

我用cocoacontrols.com的BASequenceControl实现了UISegmentedControl 方向主题。 我已经添加了BASequenceControl.h和BASequenceControl.m类和GitHub所需的图像 大。 它的工作对我来说很好..但是我有一个关于最后一个细分市场小费的问题。 它显示最后一个段的垃圾空间。 原始屏幕截图 我需要这个 我已经实现的代码 #import "BASequenceControl.h" BASequenceControl *bASequenceControl = [[BASequenceControl alloc] init]; bASequenceControl.frame = CGRectMake(10, 10, 200, 44); [bASequenceControl addSegmentWithTitle:@"First" animated:NO]; [bASequenceControl addSegmentWithTitle:@"Second" animated:NO]; bASequenceControl.leftMargin = -22; bASequenceControl.rightMargin = 0; bASequenceControl.overlapWidth = 22; [self.view addSubview:bASequenceControl]; 任何帮助,这是表示赞赏。 谢谢。

UIsegmentedControl setTintColor奇怪的行为

我有一个UISegmentedControl包含3个select地图types的选项。 我将tintcolor设置为默认的黑色,我想为选定的段设置绿色。 这是分段控制的声明 NSArray *mapType = [NSArray arrayWithObjects: @"Map", @"Hyb", @"Sat", nil]; segmentedMapType = [[UISegmentedControl alloc] initWithItems:mapType] ; segmentedMapType.segmentedControlStyle = UISegmentedControlStyleBar ; segmentedMapType.tintColor = [UIColor blackColor]; segmentedMapType.frame = CGRectMake(100, 40, 120, 40); // segmentedMapType.momentary = YES; [[[segmentedMapType subviews]objectAtIndex:0] setTintColor:[UIColor colorWithRed:0 green:.6 blue:0 alpha:1]]; [segmentedMapType setSelectedSegmentIndex:0]; [segmentedMapType addTarget:self action:@selector(selectMap:) forControlEvents:UIControlEventValueChanged]; [mapSettingsView addSubview:segmentedMapType]; 这里是select器方法 -(void)selectMap:(id)sender { int […]

iOS 5,故事板:为每个UIView自定义以编程方式创build的UITableView

在故事板中,我创build了一个UIViewController,并将更多的两个UIViews添加到同一个故事板。 然后添加UISegmentedControl来启用这些UIViews之间的切换。 我用来在UIView之间切换的方法: -(IBAction)segmentValueChaged:(id)sender { if(self.segment.selectedSegmentIndex==0) { [self.coinageView removeFromSuperview]; [self.view addSubview:nominalsView]; [self populateNominals:self.subCountryID]; } else { [self.nominalsView removeFromSuperview]; [self.view addSubview:coinageView]; } } 以及在UIView上添加UITableView的方法: -(void)populateNominals:(int)subCountryID { UITableView *nominalsTableView=[[UITableView alloc]initWithFrame:CGRectMake(0, 0, 320, 372) style:UITableViewStylePlain]; //nominalsTableView.dataSource = self; //nominalsTableView.delegate = self; [self.nominalsView addSubview:nominalsTableView]; } 这种方法工作正常,我得到一个表切换段时popup。 我的问题是,我可以在哪里定制每个段(UIView)的每个tableView? 问题是我需要两个相当不同的表(不同的devise,cellForRowAtIndexPath和不同的导航,而didSelectRowAtIndexPath)。 先谢谢你。

Swift:在UITableView Cell中,分段控件的performance方式很奇怪

任何时候我在UICell中点击分段控制,立即其他一些单元在同一个位置获得这个分段控制。 它看起来像分段控制认识到,不仅这个特定的一个被窃听,而且在其他单元中的其他一个。 你有没有遇到这样的问题? 这是我的自定义单元实现: class QuestionYesNoCustomCellTableViewCell: UITableViewCell { @IBOutlet weak var questionLabel: UILabel! @IBOutlet weak var segmentControl: ADVSegmentedControl! override func awakeFromNib() { super.awakeFromNib() // Initialization code segmentControl.items = ["TAK", "NIE"] segmentControl.font = UIFont(name: "Avenir-Black", size: 12) segmentControl.borderColor = UIColor.grayColor() segmentControl.selectedIndex = 1 segmentControl.selectedLabelColor = UIColor.whiteColor() segmentControl.unselectedLabelColor = UIColor.grayColor() segmentControl.thumbColor = UIColor(red: 46.0/255.0, green: 204.0/255.0, blue: […]

从iPhone App Store重新创build分段控件

我试图重新创build一个类似于应用程序商店的界面,使用直接在它下面的分段控件的导航栏。 我有控制器和所有相关的意见完美工作; 我的问题是我想将我的分段控制器的颜色与苹果在商店中使用的颜色相匹配。 我将如何去实现这一目标? 我已经尝试colorWithRed:绿色:蓝色:阿尔法但很less成功。 谢谢。

iOS – 这个UIPageViewController由UISegmentedControl控制,或者这是什么?

这个UIPageViewController如何被这个头部控制好像是UISegmentedControl ?

检测第二个点击段

根据文档,与UISegmentedControl有关的事件是值改变的。 假设我有一个与上一个和下一个分段控制,在我的情况下,我应该可以单击下一个UISegmentedControl , UISegmentedControl的默认行为将无法识别成功,如果再次单击相同的段。 那么如何处理呢?

点击已经select的段控制swift

我有一个UISegmentedControl 4段。 当它被选中时,它应该popup视图。 当popup窗口解散,并试图点击相同的段索引,它应该再次显示popup。 通过使用下面的popup式消息后,对同一段索引的点击没有任何操作。 segHeader.addTarget(self, action: Selector("valuechange:"), forControlEvents: .AllEvents) 要么 segHeader.addTarget(self, action: Selector("valuechange:"), forControlEvents: .ValueChanged)

带有AutoLayout错误标题的UISegmentedControl

我有一个自定义的UITableViewCell在左侧有一个标签在右边的UISegmentedControl 。 我只是习惯于在代码中使用自动布局,这是我在我的自定义单元格(使用UIView + AutoLayout ): -(void)updateConstraints { self.titleLabel.translatesAutoresizingMaskIntoConstraints = NO; self.segmentedControl.translatesAutoresizingMaskIntoConstraints = NO; [self.titleLabel pinToSuperviewEdges:JRTViewPinLeftEdge inset:DB_AUTOLAYOUT_DEFAULT_INSET]; [self.titleLabel centerInContainerOnAxis:NSLayoutAttributeCenterY]; [self.segmentedControl pinToSuperviewEdges:JRTViewPinRightEdge inset:DB_AUTOLAYOUT_DEFAULT_INSET]; [self.segmentedControl pinAttribute:NSLayoutAttributeBaseline toAttribute:NSLayoutAttributeBaseline ofItem:self.titleLabel]; [super updateConstraints]; } 我的问题是,分段控件的第一个标题总是错位: 这就是iOS 6上的样子: 在iOS 7上: 所以第一个问题是:我如何解决这个问题? 其他,切向问题:我是否通过将自动布局代码放入updateConstraints来做正确的事情,还是应该只应用一次约束?

如何更改UISegmentedControl的单个索引的字体大小?

更改UISegmentedControl字体大小的方法如下: UIFont *font = [UIFont systemFontOfSize:13.0f]; NSDictionary *attributes = [NSDictionary dictionaryWithObject:font forKey:UITextAttributeFont]; [self.segment setTitleTextAttributes:attributes forState:UIControlStateNormal]; 如何更改UISegmentedControl单个索引的字体大小? 或者甚至更好,如果文本不适合在segment (而不是“上面”,它有“Abo …”)字体大小应该更小,以便它可以适合。