Create a Segment button
Uisegmentedcontrol *segment = [[Uisegmentedcontrol alloc] Initwithframe:cgrectmake (100, 200, 100, 50)];
Set the width of the item
Uicolor *mytint = [[Uicolor alloc] initwithred:0.66 green:1.0 blue:0.77 alpha:1.0];
Segment.tintcolor = Mytint;
Add a Fragment
[Segment insertsegmentwithtitle:@ "First" atindex:0 Animated:yes];
[Segment insertsegmentwithtitle:@ "the Atindex:2 Animated:yes];
[Segment Insertsegmentwithimage:[uiimage imagenamed:@ "Ondemo"] atindex:3 Animated:yes];
Delete Segment
[Segment Removesegmentatindex:2 animated:yes];//Delete a fragment
[Segment removeallsegments];//Delete all clips
Fragment title
[Segment Setimage:[uiimage imagenamed:@ "Statrdemo"] forsegmentatindex:1];
Select Segments
Segment.momentary = YES;
Specify the selected button
Segment.selectedsegmentindex = 1;
Set Background color
Segment.backgroundcolor = [Uicolor Puoplecolor];
Add to navigation bar, no navigation bar without any effect
Self.navigationItem.titleView = segment;
Read the value of the control's fragment button
int x= Segment.selectedsegmentindex;
Add Event
[Segment Addtarget:self Action: @selector (Selectedd:) forcontrolevents:uicontroleventeditingchanged];
[Self.view addsubview:segment];
Step-by-step learning the properties of the iOS (Uisegmentedcontrol) segmented control