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];} @endCode Download:
Yards The road is too long, but I will work hard!
The Actionsheet of iOS learning, the legendary Popwindow;