摘要:
atomic和nonatomic用来决定编译器生成的getter和setter是否为原子操作。atomic设置成员变量的@property属性时,默认为atomic,提供多线程安全。在多线程环境下,原子操作是必要的,否则有可能引起错误的结果。加了atomic,setter函数会变成下面这样:{lock}if (property != newValue) {[property release];property = [newValue retain];}{unlock}nonatomic禁止多线程,变量保护,提高性能。atomic是Objc使用的一种线程保护技术,基本上来讲,是防止在写未完成的时 阅读全文
posted @ 2012-12-16 16:58
言程序
阅读(179)
评论(0)
推荐(0)
摘要:
:NSTimer的使用方法[NSTimerscheduledTimerWithTimeInterval:0.2target:selfselector:@selector(changeColor)userInfo:nilrepeats:YES];//让NSTimer消失的方法[_timer invalidate];:AVAudioPlayer的简单使用 //创建音乐文件路径NSString* musicFilePath = [[NSBundlemainBundle]pathForResource:@"jnstyle"ofType:@"mp3"];//根据路 阅读全文
posted @ 2012-12-16 16:44
言程序
阅读(211)
评论(0)
推荐(0)
摘要:
UISlider的简单使用(可拖动进度条) self.slider= [[UISlideralloc]initWithFrame:CGRectMake(0, 520, 320, 10)];self.slider.minimumValue= 0;//设置可变最小值self.slider.maximumValue= 2;//设置可变最大值self.slider.value= 5; [self.slideraddTarget:selfaction:@selector(changeValue)forControlEvents:UIControlEventValueChanged]; [self.vi. 阅读全文
posted @ 2012-12-16 16:44
言程序
阅读(2886)
评论(0)
推荐(0)
摘要:
//设置button文字阴影颜色在高亮状态显示 [buttonsetTitleShadowColor:[UIColorblueColor]forState:UIControlStateHighlighted];//为button文字设置阴影位置 [button.titleLabelsetShadowOffset:CGSizeMake(3, 3)];//为button文字设置字体大小 button.titleLabel.font= [UIFontsystemFontOfSize:23]; 阅读全文
posted @ 2012-12-16 16:41
言程序
阅读(509)
评论(0)
推荐(0)
摘要:
-(void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event{if(![self.txtField isExclusiveTouch]) { [self.txtField resignFirstResponder]; }} 阅读全文
posted @ 2012-12-16 16:40
言程序
阅读(464)
评论(0)
推荐(0)
摘要:
//创建imageViewself.imageView= [[UIImageViewalloc]initWithFrame:CGRectMake(0, 40, 320, 260)];//把图片添加到动态数组NSMutableArray* animateArray = [[NSMutableArrayalloc]initWithCapacity:20]; [animateArrayaddObject:[UIImageimageNamed:@"t1.png"]]; [animateArrayaddObject:[UIImageimageNamed:@"t2.png&q 阅读全文
posted @ 2012-12-16 16:33
言程序
阅读(2460)
评论(0)
推荐(0)

浙公网安备 33010602011771号