Briefly describe the properties and usage of uisegment

Source: Internet
Author: User

1.segmentedControlStyle

Sets the display style for the segment.

typedef ns_enum (Nsinteger, Uisegmentedcontrolstyle) {

Uisegmentedcontrolstyleplain,//large plain system default tablet style

Segmentedcontrol.segmentedcontrolstyle = Uisegmentedcontrolstyleplain;

uisegmentedcontrolstylebordered,//large bordered black edge style

Segmentedcontrol.segmentedcontrolstyle = uisegmentedcontrolstylebordered;

Uisegmentedcontrolstylebar,//small Button/nav bar style. Tintable Bar Style

Segmentedcontrol.segmentedcontrolstyle = Uisegmentedcontrolstylebar;

uisegmentedcontrolstylebezeled,//DEPRECATED. Don't use the This style. Do not use this type, use will be error OH.

};

2.tintColor Gradient Color

Default Tintcolor is nil. Only used if style is Uisegmentedcontrolstylebar

Default NULL to set the gradient color only with Uisegmentedcontrolstylebar.

Segmentedcontrol.segmentedcontrolstyle = Uisegmentedcontrolstylebar;

Segmentedcontrol.tintcolor = [Uicolor Redcolor];

Effect:

3.momentary settings are restored after clicking

Default is No

Segmentedcontrol.momentary = No;

Post-click Effects:

Segmentedcontrol.momentary = YES;

Post-click Effects:

4. numberOfSegments (Read only)

Gets the total number of options segmentedcontrol.numberofsegments

5. Selectedsegmentindex

Use to set the selected item or return the selected item.

Segmentedcontrol.selectedsegmentindex = 2;//Sets the default selection index

Segmentedcontrol.selectedsegmentindex//Get selected

6.-(void) Settitle: (NSString *) title Forsegmentatindex: (Nsuinteger) segment;

[Segmentedcontrol settitle:@ "The" forsegmentatindex:1];//set the topic of the specified index

Effect:

7.-(void) SetImage: (UIImage *) image forsegmentatindex: (Nsuinteger) segment;

[Segmentedcontrol setimage:[uiimage imagenamed:@ "Lan.png"] forsegmentatindex:3];//set the picture of the specified index

8.-(void) Insertsegmentwithtitle: (nsstring*) title Atindex: (Nsuinteger) segment animated: (BOOL) animated;

[Segmentedcontrol insertsegmentwithtitle:@ "Add" atindex:3 animated:no];//insert an option at the specified index and set the title

Effect:

9.-(void) Insertsegmentwithimage: (UIImage *) image atindex: (Nsuinteger) segment animated: (BOOL) animated;

[Segmentedcontrol insertsegmentwithimage:[uiimage imagenamed:@ "Mei.png"] atindex:2 animated:no];//Insert an option in the specified index and set the picture

10. -(void) Removesegmentatindex: (Nsuinteger) segment animated: (BOOL) animated;

[Segmentedcontrol removesegmentatindex:0 animated:no];//option to remove the specified index

Effect:

One.-(void) removeallsegments;

Remove all options

[Segmentedcontrol removeallsegments];

-(void) SetWidth: (cgfloat) Width Forsegmentatindex: (nsuinteger) segment; Set to 0.0 width to autosize. Default is 0.0

The width of the tab defaults to 0, which allows you to set the tab width.

[Segmentedcontrol setwidth:70.0 forsegmentatindex:2];//Sets the width of the specified index option

Effect:

-(void) Setcontentoffset: (cgsize) offset Forsegmentatindex: (Nsuinteger) segment; Adjust offset of image or text inside the segment. Default is (0,0)

[Segmentedcontrol setcontentoffset:cgsizemake (10,0) forsegmentatindex:1];

Sets the offset of the inner text or picture with the default position of the tab, which is the default position in the center of the tab.

Effect:

-(void) setenabled: (BOOL) enabled Forsegmentatindex: (Nsuinteger) segment;

[Segmentedcontrol setenabled:no forsegmentatindex:4];//Setting the specified index option is not selectable

15. Increase incident Response mechanism

The listener is this event: uicontroleventvaluechanged, Value Change event

[Segmentedcontrol addtarget:self Action: @selector (ItemClick) forcontrolevents:uicontroleventvaluechanged];

Briefly describe the properties and usage of uisegment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.