从网络上获取image,添加到imageview中: NSString *strings = [NSString stringWithString: @"http://www.google.com.hk/intl/zh-CN/images/logo_cn.png"]; NSData *date = [[NSData alloc] initWithContentsOfURL: [NSURL URLWithString: strings]]; UIImageView *image = [[UIImageView alloc] initWithImage: [UIImage imageWithData: date]]; image.frame = CGRectMake(0, 0, 100, 40); [self.view addSubview: image];
NSAutoreleasePool的作用: for (int i=0;i<20;i++) { NSAutoreleasePool *aa = [[NSAutoreleasePool alloc] init]; str = [[[NSString alloc] initWithFormat: @"%d", i] autorelease]; NSLog( @"str is %@" , str ); [aa release]; }
在设置textField的时候,忘记了 textField.delegate = self 所以键盘没有自动消失. - (BOOL)textFieldShouldReturn:(UITextField *)textField { [textField resignFirstResponder]; return YES; } 也没有被调用…
在设置背景色的时候,后面的随机数少写了".0",就悲剧了,一直没有出现正确的结果,其实他们接受的是CGFloat类型的值,填写后,ok了. self.window.backgroundColor = [UIColor colorWithRed: arc4random() % 255/255.0 green: arc4random() % 255/255.0 blue: arc4random() % 255/255.0 alpha: 1.0];
这些个问题,以前都做过,不过很多细节没有很好的掌握,以至于在又时间要求的情况下,不能很快的产生代码,其实还是对这些知识的熟练度不够.