Some common attributes and usages in Uisegmentedcontrol
Sets the display of a pattern as a segment, requiring only the outline of the pattern, so that the color is a segmented background color
Nsarray *items = @[[uiimage imagenamed:@ "segmented1"],[uiimage imagenamed:@ "Segmented_4"],[uiimage imageNamed:@ " Segmented_3 "],[uiimage imagenamed:@" Segmented_2 "];
Nsarray *items = @[@ "video", @ "Music", @ "picture", @ "Software"];
[[Uisegmentedcontrol appearance]setbackgroundimage:items forstate:uicontrolstatenormal barMetrics: Uibarmetricsdefault];
Uisegmentedcontrol *segmentedc =[[uisegmentedcontrol Alloc]initwithitems:items];
Set the index segment to be a picture
[Segmentedc setimage:[uiimage imagenamed:@ "Segmented_4"] forsegmentatindex:2];
Set the default number of index segments as not selectable
[Segmentedc Setenabled:no Forsegmentatindex:2];
Set the width size of the first few paragraphs
[Segmentedc setwidth:10.0 forsegmentatindex:1];
[Segmentedc settitletextattributes:unselectedtextattributes Forstate:uicontrolstatenormal];
Segmentedc.backgroundcolor = [Uicolor Browncolor];
Sets whether the click Segment reverts to the original appearance, default to No
Segmentedc.momentary = YES;
Change the content of lower-level segments
[Segmentedc settitle:@ "YES" forsegmentatindex:0];
Rectangle set to rounded corners
SegmentedC.layer.cornerRadius = 20;
Set four dashed lines with rounded corners
SegmentedC.layer.masksToBounds = YES;
Segmentedc.selectedsegmentindex = 1; The first few split segments are selected by default
Segmentedc.tintcolor = [Uicolor Yellowcolor]; Set the segmentation boundary and font Color
Segmentedc.frame =cgrectmake (5, 20, 310, 40);
Set the response when clicking on an index segment
[Segmentedc addtarget:self Action: @selector (valuechanged:) forcontrolevents:uicontroleventvaluechanged];
[Self.window Addsubview:segmentedc];
[Segmentedc release];
IOS UI Segmentedcontrol Uisegmentedcontrol Common Properties and usage