上一页 1 ··· 7 8 9 10 11 12 13 14 15 16 下一页
摘要: Block具有将临时函数体创建为表达式的优势。Apple文档中指出:Block是符合如下要求的匿名内联的代码集:和函数一样具有一个指定类型的参数列表有一个可以推导或声明的返回值类型可以从它被定义的词义范围中捕捉状态可以在需要的时候改变词义范围的状态可以和相同的词义范围中定义的其他的Block共享更改的可能。可以在词义范围(堆栈帧)被销毁后继续共享和修改该词义范围(堆栈帧)的状态。Block是一个自包含的小代码段,封装了用于遍历(线性遍历)或者回调,可以并发执行的任务单元。__block int myCount = 0;int (^myBlock)(int a,int b) = ^(int a, 阅读全文
posted @ 2013-02-06 14:03 diablo大王 阅读(1623) 评论(0) 推荐(0) 编辑
摘要: 1 UIActivityIndicatorView *av = [[UIActivityIndicatorView alloc] init]; // 活动图标 2 av.frame = CGRectMake(0, 0, 50, 50); 3 av.center = self.view.center; 4 av.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite; // 白色样式 5 av.activityIndicatorViewStyle = UIActivityIndi... 阅读全文
posted @ 2013-02-05 16:13 diablo大王 阅读(308) 评论(0) 推荐(0) 编辑
摘要: <UIPickerViewDataSource,UIPickerViewDelegate> 实现这二个协议 1 UIPickerView *pv = [[UIPickerView alloc] init]; 2 pv.delegate = self; 3 pv.dataSource = self; 4 pv.showsSelectionIndicator = YES; // 是否显示选择标示 5 6 -(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView{ 7 ... 阅读全文
posted @ 2013-02-05 16:06 diablo大王 阅读(966) 评论(0) 推荐(0) 编辑
摘要: 1 UIDatePicker *dp = [[UIDatePicker alloc] init]; 2 [dp setDate:[NSDate date] animated:YES]; // 设置日期控件值 3 [dp addTarget:self 4 action:@selector(dateValueChange:) 5 forControlEvents:UIControlEventValueChanged]; // 时间改变时触发此事件 6 7 NSDateFormatter *form = [[NSDateFormat... 阅读全文
posted @ 2013-02-05 15:51 diablo大王 阅读(2475) 评论(0) 推荐(0) 编辑
摘要: 1 UISlider *sl = [[UISlider alloc] init]; // 初始化滑块 2 sl.minimumValue = 0; // 最大值 3 sl.maximumValue = 1; // 最小值 4 sl.value = 0.5f; // 当前值 5 6 sl.minimumValueImage = [UIImage imageNamed:@"minImage.png"]; // 最小值一侧图标 7 sl.maximumValueImage = [UIImage imageNamed:... 阅读全文
posted @ 2013-02-05 15:33 diablo大王 阅读(714) 评论(0) 推荐(0) 编辑
摘要: 1、定义协议UIViewPassValueDelegate.h1 #import <Foundation/Foundation.h>2 3 @protocol UIViewPassValueDelegate <NSObject>4 -(void)passValue:(NSString *)value1;5 @end2、A视图定义 1 #import "UIViewPassValueDelegate.h" 2 3 @interface AViewController : UIViewController<UIViewPassValueDelega 阅读全文
posted @ 2013-02-05 10:48 diablo大王 阅读(2704) 评论(0) 推荐(0) 编辑
摘要: 1 UIView *view = [[UIView alloc] init];2 view.hidden = YES; // 隐藏3 [view setBackgroundColor:[UIColor colorWithRed:1.0 green:0.5 blue:0.5 alpha:1.0]]; // 设置背景颜色,此处的alpha只是让背景透明4 view.alpha = 0.6; // 设置透明效果,背景和文字都透明5 view.contentMode = UIViewContentModeBottom; // 设置与父视图位置关系6 view.c... 阅读全文
posted @ 2013-02-04 16:24 diablo大王 阅读(352) 评论(0) 推荐(0) 编辑
摘要: 1 UISegmentedControl *seg = [[UISegmentedControl alloc] 2 initWithItems:[NSArray arrayWithObjects:@"one",@"two",@"three", nil]]; 3 seg.segmentedControlStyle = UISegmentedControlStylePlain; // 设置分段按钮类型 4 seg.segmentedControlStyle = UISegmentedControlStyleBar; 5... 阅读全文
posted @ 2013-02-04 15:37 diablo大王 阅读(456) 评论(0) 推荐(0) 编辑
摘要: 1 UISwitch *sw = [[UISwitch alloc] initWithFrame:CGRectMake(0, 0, 100, 50)];2 sw.on = YES; // 开启3 [sw addTarget:self4 action:@selector(mySwitch:)5 forControlEvents:UIControlEventValueChanged]; // 值改变时触发此事件 阅读全文
posted @ 2013-02-04 15:11 diablo大王 阅读(301) 评论(0) 推荐(0) 编辑
摘要: 1 UITextField *tf = [[UITextField alloc] initWithFrame:CGRectMake(20, 20, 280, 30)]; 2 tf.borderStyle = UITextBorderStyleNone; // 无边框线 3 // UITextBorderStyleBezel(边框+阴影) ,UITextBorderStyleLine(边框线) ,UITextBorderStyleRoundedRect(圆角+阴影) 按钮样式 4 tf.text = @"xxxxx"; // 内容 5 ... 阅读全文
posted @ 2013-02-04 15:05 diablo大王 阅读(267) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 16 下一页