上一页 1 2 3 4 5 6 7 8 ··· 20 下一页
摘要: 点引用是地道的Objective-C 2.0的风格。它被使用于简单的属性set、get操作,但对象的其它行为不应该使用它。Setters中对NSString进行copy永远不要仅仅retain一个字符串。这避免了调用者在你不知道的情况下对字符串作出了修改。不要作出那样的假设:你接受的对象是一个NSString对象而不是NSMutableString对象。- (void)setFoo:(NSString *)aFoo {[foo_ autorelease];foo_ = [aFoo copy];}总结:接受NSString作为参数的setter,应该copy它所接受的字符串。这从逻辑上遵守了NS 阅读全文
posted @ 2011-09-29 18:00 Gang.Wang 阅读(1764) 评论(0) 推荐(0) 编辑
摘要: MBProgressHUD是替代UIProgressHUD的一个小工具,使用方法也非常简单下载地址是: http://github.com/matej/MBProgressHUD#import <UIKit/UIKit.h>#import "MBProgressHUD.h"@interface HudDemoViewController : UIViewController <MBProgressHUDDelegate> { MBProgressHUD *HUD;}- (IBAction) showWithLabel:(id)sender;- (vo 阅读全文
posted @ 2011-09-29 17:22 Gang.Wang 阅读(11359) 评论(0) 推荐(0) 编辑
摘要: #import <Foundation/Foundation.h>#import <UIKit/UIKit.h>@interface UITableViewCell (UITableViewCellExt)- (void)setBackgroundImage:(UIImage*)image;- (void)setBackgroundImageByName:(NSString*)imageName;@end#import "UITableViewCellExt.h"@implementation UITableViewCell (UITableView 阅读全文
posted @ 2011-09-24 17:31 Gang.Wang 阅读(1671) 评论(0) 推荐(0) 编辑
摘要: 自动补全 : esc查找项目文件:command+t查找文件内符号:shift+command+t跳到某行:command+l选择:shift+方向键向后缩进:option+tab向前缩进:shift+option+tabreformat 所选:option+command+[大写所选:control+u小写所选:control+shift+u查找:command+f查找下一个:command+gshow TODO list :control+shift+t计算数学公式:control+shift+c统计字数:control+shift+n注释与取消:command+/mate file 终端 阅读全文
posted @ 2011-09-22 11:51 Gang.Wang 阅读(4073) 评论(0) 推荐(0) 编辑
摘要: UITapGestureRecognizer* singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];[self.view addGestureRecognizer:singleTap]; //这个可以加到任何控件上,比如你只想响应WebView,我正好填满整个屏幕singleTap.delegate = self;singleTap.cancelsTouchesInView = NO;[singleTap release];- (BOOL)gest 阅读全文
posted @ 2011-09-21 21:24 Gang.Wang 阅读(343) 评论(0) 推荐(0) 编辑
摘要: 0CGContextRef context = UIGraphicsGetCurrentContext(); 设置上下文1 CGContextMoveToPoint 开始画线2 CGContextAddLineToPoint 画直线4 CGContextAddEllipseInRect 画一椭圆4 CGContextSetLineCap 设置线条终点形状4 CGContextSetLineDash 画虚线4 CGContextAddRect 画一方框4 CGContextStrokeRect 指定矩形4 CGContextStrokeRectWithWidth 指定矩形线宽度4 CGConte 阅读全文
posted @ 2011-09-20 11:26 Gang.Wang 阅读(674) 评论(0) 推荐(0) 编辑
摘要: -(void)viewDidLoad{array = [[NSMutableArray alloc] init];int i = 1;for(i;i<=30;i++){ [array addObject:[UIImageimageNamed:[NSString stringWithFormat:@"%d.jpg",i]]];}pictures.animationImages = array;pictures.animationDuration = 300;//时间间隔pictures.animationRepeatCount = 0;//循环播放[pictures s 阅读全文
posted @ 2011-09-20 11:19 Gang.Wang 阅读(848) 评论(0) 推荐(0) 编辑
摘要: CALayer的CATransition就可以. CATransition *animation = [CATransition animation]; [animation setDelegate:self]; // [animation setType:@"oglFlip"]; [animation setType:@"cube"]; //[animation setType:kCATransitionPush]; [animation setSubtype:direction]; [animation setDuration:1.0f]; [ani 阅读全文
posted @ 2011-09-20 11:04 Gang.Wang 阅读(1791) 评论(0) 推荐(0) 编辑
摘要: const CGFloat kReflectPercent = -0.25f;const CGFloat kReflectOpacity = 0.3f;const CGFloat kReflectDistance = 10.0f;+ (void) addSimpleReflectionToView: (UIView *) theView{CALayer *reflectionLayer = [CALayer layer];reflectionLayer.contents = [theView layer].contents;reflectionLayer.opacity = kReflectO 阅读全文
posted @ 2011-09-20 11:01 Gang.Wang 阅读(742) 评论(1) 推荐(0) 编辑
摘要: 把多张图片整合成连续动画,这恐怕是很多苹果开发者需要的功能。下面是单次播放和循环播放的代码:animationImageView.animationImages = imageFrames;// imageFrames 是一个图片数组 animationImageView是一个imageview[UIView setAnimationDelegate:self];animationImageView.animationDuration = 0.75f; animationImageView.animationRepeatCount = 3; [animationImageView startA 阅读全文
posted @ 2011-09-19 11:08 Gang.Wang 阅读(628) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 20 下一页