0
嗨有一個應用程序在哪裏必須顯示UISegmentedControls,但UISegment上的文本是從段向左。如何在UISegmented控制中心添加文本?如何在中心對齊UISegment文本
optionControl = [[UISegmentedControl alloc]initWithItems:optionNameArr];
[optionControl setFrame:CGRectMake(ReportingPanelScrollView.frame.size.width/2.8+80, y_Val +x_Dis, 100, 30)];
UIFont *font = [UIFont systemFontOfSize:12.0f];
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:font,UITextAttributeFont,[UIColor darkTextColor],UITextAttributeTextColor,nil];
[optionControl setTitleTextAttributes:attributes forState:UIControlStateNormal];
optionControl.segmentedControlStyle = UISegmentedControlStyleBordered;
optionControl.tag = sectionHeader*2000+itemHeader+200;
NSString *tagStr = [NSString stringWithFormat:@"%d",optionControl.tag];
[optionItemControlDict setObject:optionSelectedTextArr forKey:tagStr];
[optionControl addTarget:self action:@selector(OptionControlSelected:) forControlEvents:UIControlEventValueChanged];
[ReportingPanelScrollView addSubview:optionControl];
[optionControl release];