zoukankan      html  css  js  c++  java
  • 进击的UI--------------UIActionSheet(提示)

    // UIActionSheet这个控件很常用,和UIAlertView类似,先附图
    // 添加了过多的选项,就会以列表的形式显示
    IOS--UIActionSheet详细使用
     
    // 正常显示
    IOS--UIActionSheet详细使用
     
    // 下面直接上代码
    // 注意,需要在头文件中实现UIActionSheetDelegate协议
    UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"请选择你喜欢的水果"                                                      delegate:self                                                      cancelButtonTitle:@"取消"
    destructiveButtonTitle:@"确定" // 这个按钮的会以红色显示,在次设置一些重要的选项                                                    otherButtonTitles:@"苹果", @"葡萄", @"大枣儿", @"哈密瓜", @"杏儿", @"荔枝", nil];
    actionSheet.delegate = self; // 设置代理为本身actionSheet.actionSheetStyle = UIActionSheetStyleAutomatic; // 设置样式  
    [actionSheet showInView:self.view]; // 设置UIAcitonSheet在哪个view上显示
    [actionSheet release], actionSheet = nil;
    // 代理方法
    #pragma mark - 重写-----UIActionSheetDelegate协议中的方法
    #pragma mark 判断您点击的是哪个按钮
    - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
        NSLog(@"点击了序号为 %d 的按钮", buttonIndex);
    }
    #pragma mark 将要隐藏
    - (void)actionSheet:(UIActionSheet *)actionSheet willDismissWithButtonIndex:(NSInteger)buttonIndex {
    NSLog(@"点击序号为 %d 的按钮  <<span style="line-height: normal; font-family: 'Heiti SC Light'; ">将要>  使UIActionSheet隐藏", buttonIndex);
    }
    #pragma mark 已经隐藏
    - (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex {
    NSLog(@"点击序号为 %d 的按钮  <<span style="line-height: normal; font-family: 'Heiti SC Light'; ">已经>  使UIActionSheet隐藏", buttonIndex);}
    #pragma mark 不明白这个方法,希望懂的告诉下
    - (void)actionSheetCancel:(UIActionSheet *)actionSheet {
    }
     
  • 相关阅读:
    SuperSocket 1.4 stable正式发布
    用ILMerge合并Silverlight, WindowsPhone或Mono for Android的程序集
    给手势UITapGestureRecognizer添加"tag"标志
    ios 时间差计算 转
    webView基本用法
    iphone5页面适配修改
    net 面试题集锦
    绝笔绝路逢生
    请教:福州都有哪些健身俱乐部
    Fedora 17 安装 VMware Tools 的先决条件
  • 原文地址:https://www.cnblogs.com/sharkHZ/p/4984176.html
Copyright © 2011-2022 走看看