UI Sigment Properties and methods and cases

Source: Internet
Author: User

Set Display items for segment

Self.mysegment=[[uisegmentedcontrol alloc]initwithitems:@[@ "Red" @ "blue" @ "green"];

Add Item

[Self.mysegment insertsegmentwithtitle:@ "Yellow" atindex:3 animated:yes];

Add the Default check

Self.mysegment.selectedsegmentindex=1;

Set Location

Self.mysegment.frame=cgrectmake (100, 100, 200, 50);

Add Event

[Self.mysegment addtarget:self Action: @selector (Changea) forcontrolevents:uicontroleventvaluechanged];

[Self.view addSubview:self.mySegment];

Case List

Self.myimage = [[Uiimageview alloc] Initwithframe:cgrectmake (0,60, Self.view.frame.size.width, SELF.VIEW.FRAME.SIZE.HEIGHT-50)];

[Self.view AddSubview:self.myimage];

Text

Self.lblnn=[[uilabel Alloc]initwithframe:cgrectmake (50, 500, 300, 100)];

[Self.lblnn Settextcolor:[uicolor Greencolor];

self.lblnn.numberoflines=5;

Sets the display item for the segment.

Self.mysegment=[[uisegmentedcontrol alloc]initwithitems:@[@ "Peach blossom", @ "Plum blossom", @ "cherry blossom"];

Set Location

Self.mysegment.frame=cgrectmake (100, 20, 200, 30);

Add Event

[Self.mysegment addtarget:self Action: @selector (change) forcontrolevents:uicontroleventvaluechanged];

Add to view

[Self.view addSubview:self.mysegment];

}

-(void) Change

{

int index= (int) Self.mysegment.selectedSegmentIndex;

Switch (index) {

Case 0:

Get Pictures

Self.myimage.image = [UIImage imagenamed:@ "Timg-2.png"];

Add to Parent View

[Self.view AddSubview:self.myimage];

Self.lblnn.text [email protected] "rose family, peach plant." small deciduous trees; leaves narrow-elliptic to lanceolate, 15 cm long, 4 cm wide, apex growing and finely pointed, margin finely toothed, dark green glossy, leaf base with nectar glands. ";

[Self.view AddSubview:self.lblnn];

Break

Case 1:

Get Pictures

Self.myimage.image = [UIImage imagenamed:@ "Timg.png"];

Add to Parent View

[Self.view AddSubview:self.myimage];

Self.lblnn.text [email protected] "Plum, aka Mei, alias: Plum, dried plum, plum, plum, rose family, apricot small trees, sparse shrubs, bark grayish or greenish, smooth; branchlets green, smooth glabrous. Leaf blade ovate or elliptic "";

[Self.view AddSubview:self.lblnn];

Break

Case 2:

Get Pictures

Self.myimage.image = [UIImage imagenamed:@ "12009759_224414328147_2.png"];

Add to Parent View

[Self.view AddSubview:self.myimage];

Self.lblnn.text [email protected] "Cherry blossom (scientific name: Cerasus ssp.): It is a general term for several plants of the genus Rosa, and in the new revision of the Chinese plant records, it refers to" Tokyo Cherry Blossom ", also known as" Japanese cherry blossom ". There are more than 300 kinds of cherry blossoms in the world, there are about 150 species of cherry blossom, there are more than 50 species in China. There are about 40 species of wild species of cherry plants in the world, there are 33 species originating from China.

[Self.view AddSubview:self.lblnn];

Break

Default

Break

}

}

UI Sigment Properties and methods and cases

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.