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
  • 相关阅读:
    区别@ControllerAdvice 和@RestControllerAdvice
    Cannot determine embedded database driver class for database type NONE
    使用HttpClient 发送 GET、POST、PUT、Delete请求及文件上传
    Markdown语法笔记
    Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required
    Mysql 查看连接数,状态 最大并发数(赞)
    OncePerRequestFilter的作用
    java连接MySql数据库 zeroDateTimeBehavior
    Intellij IDEA 安装lombok及使用详解
    ps -ef |grep xxx 输出的具体含义
  • 原文地址:https://www.cnblogs.com/gcb999/p/3289604.html
Copyright © 2011-2022 走看看