iOS Development Learning # Reminder Processing # (2) Response Action form

Source: Internet
Author: User

In the action form we use a lot of buttons to implement, here we use the Uiactionsheetdelegate protocol in the Actionsheet:clickedbuttonatindex: method implementation, the syntax of the following form:

-(void) Actionsheet: (uiactionsheet*) Actionsheet Clickedbuttonatindex: (Nsinteger) Buttonindex;

where (uiactionsheet*) Actionsheet is used to specify the buttons contained in the Action form, (Nsinteger) Buttonindex is used to specify the index of the clicked button


The core code is as follows:

ViewController.h

#import <UIKit/UIKit.h> @interface viewcontroller:uiviewcontroller<uiactionsheetdelegate>{    Iboutlet Uitextview *tv;    Iboutlet UILabel *l;} -(ibaction) AA: (ID) sender; @end


viewcontroller.m

-(ibaction) AA: (ID) Sender {uiactionsheet *ac = [[Uiactionsheet alloc]initwithtitle:@ "Language selection" Delegate:self Cancelbuttont    itle:@ "OK" destructivebuttontitle:@ "Chinese" otherbuttontitles:@ "English", @ "Japanese", nil]; [AC ShowInView:self.view];} -(void) Actionsheet: (Uiactionsheet *) Actionsheet Clickedbuttonatindex: (nsinteger) buttonindex{NSString *t = [actionSh    Buttontitleatindex:buttonindex]; if ([t isequaltostring:@ "Chinese"]) {Tv.text = @ "There was a lovely little girl, who had seen it all, but her grandmother, who liked her most, gave her what she wanted." Once, Grandma gave the little girl a velvet Little Red Riding Hood, worn on her head just right. Since then, the girl no longer want to wear any other hats, so everyone called her "Little Red Riding Hood."        ";    L.text = @ "Little Red Riding Hood"; }else if ([t isequaltostring:@ "English"]) {Tv.text = @ "ONCE&NBSP;THERE&NBSP;WAS&NBSP;A&NBSP;LITTLE&NBSP;GIRL,&NBSP;SHE&N bsp;always wore a red hat, so everybody called her the  Little red hat.one day little red hat ' S mother said to her, " Little red hat, your grandma is ill, please go and see her, give her these cakes. remember you must  Walk along the main road. "   "Yes, mum i remember." SHE&NBSP;TOOK&NBSP;THE&NBSP;CAKES&NBSP;AND&NBSP;MADE&NBSP;HER&NBSP;WAY&NBSP;TO&NBSP;HER&NBSP;GRANDMA ' s.  She walked and walked. suddenly she came across a big grey          wolf.  ";    L.text = @ "litle Red Riding Hood"; }else if ([t isequaltostring:@ "Japanese"]) {Tv.text = @ "Haruko (はるこ) さんの home は Nihonbashi (にほんばし) にはありません. Asakusa (あさくさ) near (ちか) くにあります. はその (かみなりもん) west Side (にしがわ) にあります. The family (かぞく) は three people ですので. Tael (りょうしん) と ですので.        ";    L.text = @ "Haruko (はるこ)"; }}


iOS Development Learning # Reminder Processing # (2) Response Action form

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.