The Actionsheet of iOS learning, the legendary Popwindow;

Source: Internet
Author: User

This summer came too fast, not to hurry to go to the world to see, forget, look at it, every day of the big white legs look at me is also elated Ah, see my night is not careless of the code. To get down, we have to learn, like the big God in the group to see, What (Guo Shen, Wang Yang, anyway are god), see them, I feel that their own ... This control is used relatively high frequency!


Good simple:

myactionsheet.m//myactionsheet////Created by Xiaoyuan on 15/4/25.//Copyright (c) 2015 Xiaoyuan. All rights reserved.//#import "MyActionSheet.h" #import "MBProgressHUD.h" @interface Myactionsheet () <    Uiactionsheetdelegate> @end @implementation myactionsheet-(void) viewdidload {[Super viewdidload];    Self.navigationController.navigationBar.barTintColor =[uicolor Graycolor];    [Self.navigationController.navigationBar Settranslucent:yes];    int width = self.view.frame.size.width;        int height = self. view.frame.size.height;    UIBUTTON*BTN =[[uibutton alloc] Initwithframe:cgrectmake (0, HEIGHT/2, 50, 50)]; Fillet//UIButton *btn = [UIButton buttonwithtype:uibuttontyperoundedrect];//btn.autoresizingmask = Uiviewautoresizin Gflexibleleftmargin |    uiviewautoresizingflexiblerightmargin;//btn.frame = CGRectMake (0, 100, 100, 100);    [Btn settitle:@ "fuck" forstate:uicontrolstatenormal];    Btn.backgroundcolor =[uicolor Greencolor]; [BTN Addtarget:self ActIon: @selector (Fuck) forcontrolevents:uicontroleventtouchupinside];    [Self.view ADDSUBVIEW:BTN];    Cgpoint Center = btn.center;    center.x = self.view.center.x;    Btn.center = center;    [BTN sizetofit];//package content}-(void) didreceivememorywarning {[Super didreceivememorywarning]; Dispose of any resources the can be recreated.} -(void) fuck{uiactionsheet*sheet = [[Uiactionsheet alloc]initwithtitle:@] Please select your character "Delegate:self cancelbuttontitle:@"    Do not cancel the "destructivebuttontitle:@" two-Force "otherbuttontitles:@", nil];    Sheet.actionsheetstyle = Uiactionsheetstyleblackopaque;    [Sheet ShowInView:self.view]; }-(void) Actionsheet: (Uiactionsheet *) Actionsheet Clickedbuttonatindex: (nsinteger) buttonindex{switch (buttonIndex)            {case 0: [Self showtoast:self msg:@ "two-force"];        Break            Case 1: [Self showtoast:self msg:@ "tease Force"];        Break            Case 2: [Self showtoast:self msg:@ "idiot"];                    Break Default           Break }}-(void) Showtoast: (Uiviewcontroller *) VC msg: (NSString *) msg {Mbprogresshud *hud = [Mbprogresshud showhudaddedto:vc.        Navigationcontroller.view Animated:yes];    Configure for text with and offset down hud.mode = Mbprogresshudmodetext;    Hud.labeltext = msg;    Hud.yoffset = VC.VIEW.FRAME.SIZE.HEIGHT/2;    Hud.removefromsuperviewonhide = YES;        [HUD SizeToFit]; [HUD Hide:yes afterdelay:1.5];} @end
Code Download:

Yards The road is too long, but I will work hard!

The Actionsheet of iOS learning, the legendary Popwindow;

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.