摘要:
colorWithAlphaComponentUIColor *color = [UIColor redColor];[color colorWithAlphaComponent:0.5f];当设置完红色后,调用此方法设置颜色透明度,为啥不起作用;它是返回新的包含透明度的颜色, 而不是设置color的颜色。这样用:UIColor *color = [UIColor redColor];UIColor *cl = [color colorWithAlphaComponent:0.5f];color没有透明度,cl有透明度。 阅读全文
摘要:
库中添加AVFoundation.framework#import<AVFoundation/AVFoundation.h>@interface tanzoe_ViewController :UIViewController<AVAudioPlayerDelegate>//添加协议<AVAudioPlayerDelegate>{AVAudioPlayer *mp3;//定义对象}NSString *questionSoundName = @"pao_bg";NSString *currentSoundFilePath = [[NSBund 阅读全文
摘要:
[UIView commitAnimations]; [UIViewbeginAnimations:nil context:nil]; [UIViewsetAnimationRepeatAutoreverses:YES];//动画是否返回 [UIViewsetAnimationDuration:0.3]; button.alpha=0; [UIViewcommitAnimations];CATransition的type属性1.#define定义的常量kCATransitionFade交叉淡化过渡kCATransitionMoveIn新视图移到旧视图上面kCATransitionPu... 阅读全文
摘要:
NSArray:有序的集合,存储的元素在一个整块的内存中并按序排列(废话,我学过c语言的数组这还不知道啊);NSSet:无序的集合,散列存储。读developer.apple关于NSSet的解释:You can use sets as an alternative to arrays when the order of elements isn’t important and performance in testing whether an object is contained in the set is a consideration—while arrays are ordered, 阅读全文
摘要:
可以用字符串来找方法SEL 变量名 = NSSelectorFromString(方法名字的字符串);//注意 变量名 不是指针 可以运行中用SEL变量反向查出方法名字字符串NSString *变量名 = NSStringFromSelector(SEL参数); 阅读全文
摘要:
label.transform = CGAffineTransformMakeRotation(90 *M_PI / 180.0);//顺时针旋转 90度label.transform = CGAffineTransformMakeRotation(180 *M_PI / 180.0);//顺时针旋转180度label.transform = CGAffineTransformMakeRotation(270 *M_PI / 180.0);//顺时针旋转270度CGAffineTransform transform = label.transform;transform = CGAffineT 阅读全文
摘要:
UIAlertView * baseAlert; baseAlert =[[[UIAlertView alloc]initWithTitle:@"please wait" message:nildelegate:self cancelButtonTitle:nil otherButtonTitles:nil]autorelease];//定义[baseAlert show];UIActivityIndicatorView *aiv = [[UIActivityIndicatorViewalloc]initWithActivityIndicatorStyle:UIActivi 阅读全文
摘要:
[[UIApplication sharedApplication] setStatusBarHidden:YES];隐藏状态栏[UIApplication sharedApplication].applicationIconBadgeNumber =5; 给应用程序贴标记[[UIApplication sharedApplication] setIdleTimerDisabled:YES]; 不让程序待机使用网络活动指示器(即状态栏菊花转动)UIApplication *app = [UIApplication sharedApplication]; app.networkActivityI 阅读全文
摘要:
release一个对象后立即把指针清空 (release一个空指针完全是合法的,不会发生任何事情)[object release];object = nil;指针赋值给另一个指针NSMutableArray *array = [[NSMutableArray alloc]init];NSLog(@"%d",[array retainCount]);//count is 1NSMutableArray *temp = array;[temp retain];NSLog(@"%d,%d",[array retaincount],[temp retaincou 阅读全文
摘要:
- (void)viewDidLoad{[super viewDidLoad];UIImage * image = [UIImage imageNamed:@"alien.png"];CGSize size = image.size;UIImageView *imgview = [[UIImageView alloc]initWithFrame:(CGRect){{100,100},size}];imgview.image = image; [self.view addSubview:imgview];imgview.userInteractionEnabled = YES 阅读全文