下载地址 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(, , ,);
[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(, , , ) 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: WithDataArray:@[@"标题一",@"标题二"]];//选择
CGRect hrect,rect=self.view.bounds;
pre.delegate=self;
pre.method=@selector(selectData:);
CGRectDivide(rect, &hrect, &rect, , 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