iphone实现弹出框视图
来源:互联网 发布:大连育知同创面试 编辑:程序博客网 时间:2024/05/21 08:10
转:http://blog.csdn.net/wadelin511/article/details/8508740
2013-01-16 11:4047人阅读评论(0)收藏举报
最近项目中需要写复杂的表单,需要添加日期和多选框内容,所以需要弹出视图添加相关信息。这里写一个原型,用来帮助同事做复杂的表单。
模仿的效果:
实现的效果:
实现步骤如下:
- 创建项目iphone_sprintview
- 创建一个继承UIView的子类SecondView
- 创建一个SecondView.xib。
- 下面打开SecondView.xib,做如下操作:
添加视图:
- 在iphone_sprintviewViewController中添加相应控件的声明。
IBOutlet UIDatePicker *myDataPicker;
IBOutlet UIView *myView;
- 控件关联。
- 相关的代码:
#import <UIKit/UIKit.h>
#import "SecondView.h"
@interface iphone_sprintviewViewController : UIViewController {
SecondView *mySecondView;
IBOutlet UIDatePicker *myDataPicker;
IBOutlet UIView *myView;
}
@property (nonatomic,retain) SecondView *mySecondView;
@property (nonatomic,retain) UIDatePicker *myDataPicker;
@property (nonatomic,retain) UIView *myView;
-(IBAction)onClickButton:(id)sender;
@end
#import "iphone_sprintviewViewController.h"
#import <QuartzCore/QuartzCore.h>
@implementation iphone_sprintviewViewController
@synthesize mySecondView,myDataPicker,myView;
-(void) viewDidLoad
{
self.mySecondView=[[SecondView alloc] init];
NSArray *array =[[NSBundle mainBundle] loadNibNamed:@"SecondView"
owner:self options:nil];
self.mySecondView=[array objectAtIndex:0];
//将图层的边框设置为圆脚
self.myView.layer.cornerRadius = 8;
self.myView.layer.masksToBounds = YES;
//给图层添加一个有色边框
self.myView.layer.borderWidth = 8;
self.myView.layer.borderColor = [[UIColor colorWithRed:0.52 green:0.09 blue:0.07 alpha:0.5] CGColor];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (void)viewDidUnload {
self.mySecondView=nil;
self.myDataPicker=nil;
self.myView=nil;
}
- (void)dealloc {
[self.myView release];
[self.mySecondView release];
[self.myDataPicker release];
[super dealloc];
}
-(IBAction)onClickButton:(id)sender
{
if ([sender tag]==0) {
[self.view addSubview:mySecondView];
}else if ([sender tag]==1) {
[mySecondView removeFromSuperview];
}else {
NSLog(@"==%@",self.myDataPicker.date);
[mySecondView removeFromSuperview];
}
}
@end
源代码:http://easymorse-iphone.googlecode.com/svn/trunk/iphone.sprintview/
- iphone实现弹出框视图
- iphone实现弹出框视图
- iPhone弹出视图
- iPhone版的弹出视图
- Iphone开发,做弹出视图Popup View
- iPhone下弹出视图的方法
- iOS UIPresentationController实现弹出视图
- IOS 实现键盘弹出视图上移功能
- IOS 实现键盘弹出视图上移功能
- swift3 实现键盘弹出视图上移
- 弹出视图
- 弹出视图
- 弹出视图
- iphone 提示(弹出)框的使用
- iphone--UIWebView中js弹出框修改-
- 输入框键盘弹出视图相应上移
- iOS开发-微信右侧弹出视图实现
- iOS实现自定义的弹出视图(popView)
- 软件项目中应该遵循的20个法则
- 【Tool】我的Gvim配置
- xcopy命令怎么用
- 远程答题的稳定与速度同样重要
- webview hook
- iphone实现弹出框视图
- jQuery 1.6 .attr() 和 .prop()
- 常见错误:Apple Mach-O Linker Error
- 验证码识别软件的六大钻石亮点!
- 简单几步让vs2010支持html5
- 总结过去10年的程序员生涯(转自网友)
- 黑马程序员——java编程那些事儿____基本数据类型对象包装类及其jdk1.5新特性
- java学习资料库
- 向文件中写数据的方法