zoukankan      html  css  js  c++  java
  • ios中 radioButton和DataPIcker,九宫格封装好使用

    下载地址 http://pan.baidu.com/share/link?shareid=2894506499&uk=923776187

    引用这几个文件

    radiobutton。封装好单选按钮

    DataPicker  封装好选择器

    jiugongge  九宫格

    commonButton 这个是公用的button.

    nsCategory

    使用方式

    #import <UIKit/UIKit.h>
    #import "RadioButtonExt.h"
    
    @interface ViewController : UIViewController<RadioButtonExtDelegate>
    
    @end
    
    #import "ViewController.h"
    #import "DIYJGGView.h"
    #import "JSPresentCommonViewCtrl.h"
    #import "PresentView.h"
    
    
    @interface ViewController ()
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad
    {
        [super viewDidLoad];
        // Do any additional setup after loading the view, typically from a nib.
        [self RadioButtonSelect];
        UIButton *btn=[UIButton buttonWithType:UIButtonTypeRoundedRect];
        btn.frame=CGRectMake(0, 100, 50,50);
        [self.view addSubview:btn];
        [btn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
        
      
        
    }
    
    #pragma mark -radiobutton
    -(void)RadioButtonSelect{
        NSArray *arr=@[@"标题1",@"标题2",@"标题3"];
        RadioButtonExt *ext=[[RadioButtonExt alloc] initWithFrame:CGRectMake(0, 0, 320, 100) data:arr];
        ext.delegate=self;
        ext.backgroundColor=[UIColor redColor];
        [self.view addSubview:ext];
        [ext release];
        
    
    }
    
    #pragma mark -DataPicker
    -(void)click:(UIButton *)btn{
        for (UIViewController *vc in self.childViewControllers) {
            [vc removeFromParentViewController];
        }
    //    JSPresentCommonViewCtrl *pre=[[JSPresentCommonViewCtrl alloc] initWithPresentType:1 WithDataArray:nil];//日期
        JSPresentCommonViewCtrl *pre=[[JSPresentCommonViewCtrl alloc] initWithPresentType:0 WithDataArray:@[@"标题一",@"标题二"]];//选择
        CGRect hrect,rect=self.view.bounds;
        pre.delegate=self;
        pre.method=@selector(selectData:);
        CGRectDivide(rect, &hrect, &rect, 260, CGRectMaxYEdge);
        [PresentView showWithSubView:pre.view subVFrame:hrect];
        [self addChildViewController:pre];
        [pre release];
    }
    
    #pragma mark -单选按钮的代理方法
    -(void)RadioButton:(RadioButtonExt *)rd from:(NSInteger)from to:(NSInteger)to{
        NSLog(@"_from--%zi--->to-->%zi",from,to);
    }
    #pragma mark -DataPicker代理方法
    -(void)selectData:(NSString *)selectStr{
        [PresentView hidePresentSubView];
        NSLog(@"__>%@",selectStr);
    }
    
    @end
  • 相关阅读:
    [硬件]_ELVE_VS2015下opencv3.3的配置问题
    [Linux]_ELVE_ssh登录远程阿里服务器
    [python]_ELVE_pip2和pip3如何共存
    U盘无法打开提示格式化?如何进行恢复
    [转]pycharm的一些快捷键
    文件上传Django
    ansible编译安装--操作系统环境Redhat6.4
    django的models字段介绍
    paramiko模块
    mysql安装等操作
  • 原文地址:https://www.cnblogs.com/gcb999/p/3289604.html
Copyright © 2011-2022 走看看