IOS學習之ActionSheet,傳說中的popWindow;

來源:互聯網
上載者:User

標籤:ios   actionsheet   編程   

這夏天來的太快,還沒來的急去世界去看看,算了,在這看吧,每天的大白腿看的我也是心花怒放啊,看我的晚上無心擼碼了。言歸正傳,必須得學習了,得像群裡的大神看起了,什麼(郭神了,泓洋神了,反正都是神),看見他們,我都覺得的自己。。。。。。這個控制項使用頻率比較高!


好簡單:

////  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)];    //圓角//    UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];//    btn.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | 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];//包裹內容}- (void)didReceiveMemoryWarning {    [super didReceiveMemoryWarning];    // Dispose of any resources that can be recreated.}-(void) fuck{    UIActionSheet*sheet = [[UIActionSheet alloc]initWithTitle:@"請選擇你的性格" delegate:self cancelButtonTitle:@"不許取消" destructiveButtonTitle:@"二逼" otherButtonTitles:@"逗比", nil];    sheet.actionSheetStyle = UIActionSheetStyleBlackOpaque;    [sheet showInView:self.view];    }-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{    switch (buttonIndex) {        case 0:            [self showToast:self msg:@"二逼"];            break;        case 1:             [self showToast:self msg:@"逗逼"];            break;        case 2:             [self showToast:self msg:@"傻逼"];            break;                    default:            break;    }}-(void) showToast:(UIViewController *)vc msg:(NSString *)msg {    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:vc.navigationController.view animated:YES];        // Configure for text only 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
代碼下載:

碼農的路太長,但是我一定會好好努力!

IOS學習之ActionSheet,傳說中的popWindow;

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.