摘要: 1、在Mac上显示和取消隐藏文件夹的命令:------>便于开发 1>defaults write com.apple.finder AppleShowAllFiles YES 2>defaults write com.apple.finder AppleShowAllFiles NO2、获取沙盒Documents全路径的快捷方法 NSSearchPathForDirectoriesInDomains(NSDocumentationDirectory,NSUserDomainMask, YES)[0]3.数据存取 0>.应用沙盒 1.Documents 保存应用运行时. 阅读全文
posted @ 2013-12-23 00:52 nx的封装 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 手势识别一、1.点按UITapGestureRecognizer2.长按UILongPressGestureRecognizer if (UIGestureRecognizerStateBegan == recongnizer.state) {//如果自己的状态等于开始 [recongnizer.view setTransform:CGAffineTransformMakeRotation(M_PI)];//就设置transform旋转属性为180; }else if(UIGestureRecognizerStateEnded == recongnizer.state){ ... 阅读全文
posted @ 2013-12-23 00:43 nx的封装 阅读(345) 评论(0) 推荐(0) 编辑
摘要: 一、生成PDF文件步骤: 1创建PDF上下文 //1>.获取沙盒路径 NSString *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0]; //2>.拼接路径 NSString *PDFPath = [path stringByAppendingPathComponent:@"123.pdf"]; //3>.创建PDF上下文 UIGraphicsBeginPDFContextToFile(PD... 阅读全文
posted @ 2013-12-23 00:39 nx的封装 阅读(883) 评论(0) 推荐(0) 编辑
摘要: 一、CALayer自定义视图-->自定图层的执行顺序 1>执行自定义视图的- (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx 方法 2>执行自定义视图的 - (void)drawRect:(CGRect)rect方法 3>执行自定义图层的 - (void)drawInContext:(CGContextRef)ctx方法二、图片翻转的技巧- (void)drawInContext:(CGContextRef)ctx{ // 在对坐标系进行调整前,需要保存状态,绘图完毕后,需要恢复状态 CGCont 阅读全文
posted @ 2013-12-23 00:38 nx的封装 阅读(270) 评论(0) 推荐(0) 编辑
摘要: 一、CALayer的可动画属性 //1.取出触到屏幕上的点 UITouch *touch = [touches anyObject]; CGPoint location = [touch locationInView:self.view]; //2.将这个点设置为position _layer.position = location; //3.随机生成颜色 NSInteger i = arc4random_uniform(_colors.count); _layer.backgroundColor = [_colors[i] CGColor]; ... 阅读全文
posted @ 2013-12-23 00:36 nx的封装 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 具体实现步骤:在viewdidLoad中实现即可 //1.设置imageView UIImage *image = [UIImage imageNamed:@"头像1"]; UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; //2.设置imageView的layer的位置为控制器view的中心点 imageView.layer.position = self.view.center; [self.view addSubview:imageView]; //3.设置边框 ... 阅读全文
posted @ 2013-12-23 00:35 nx的封装 阅读(394) 评论(0) 推荐(0) 编辑
摘要: 使用Block来传递消息 --->block和代理委托一样,都是一级一级往上传递的。 1>声明一个Block--->定义一个Block typedef void(^SelectColorBlock)(UIColor *color); 2>Block一般放在initFrame方法后面,增加块代码参数。 - (id)initWithFrame:(CGRect)frame afterSelectColor:(SelectColorBlock)afterSelectColor; 3>定义一个成员变量用来记录块代码参数 SelectColorBlock _selectBlo 阅读全文
posted @ 2013-12-23 00:34 nx的封装 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 触摸事件练习1.如果想让一个空间随你的手指的移动而移动,那么就再touchmove的方法中。 UITouch *touch = [touches anyObject]; CGPoint asd = [touch locationInView:self.view]; self.redView.center = asd;2.拦截视图点击方法---->返回谁,就是点了谁//用于检测具体响应用户触摸点视图的方法- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event{ return self.blue;}3.摇一摇 1... 阅读全文
posted @ 2013-12-21 20:11 nx的封装 阅读(264) 评论(0) 推荐(0) 编辑
摘要: #pragma mark 绘制文本- (void)drawText{ NSString *text = @"床上明月光,疑是地上霜."; UIFont *font = [UIFontsystemFontOfSize:17]; NSDictionary *dict = @{ NSFontAttributeName : font, NSForegroundColorAttributeName : [UIColorredColor] }; CGRect rect = [text boundingRectWithSize:... 阅读全文
posted @ 2013-12-19 23:05 nx的封装 阅读(268) 评论(0) 推荐(0) 编辑
摘要: 网络请求的两种方式1.GET------->是获取指定的URL上的资源1>不安全不会将用户的信息暴露在URL中2>传输数量小,主要是因为URL的长度有限3>将数据按照variable = value的形式,添加到action所指向的URL后面,并且两者使用“?”连接,各个变量之间使用“&”连接。2.POST------->对指定资源“追加/添加”数据1>将数据放在数据体中,按照便利和值相对应的方式,传递到action所指向URL2>所有数据对用户来说不可见3>可以传输大量数据,上传文件只能使用Post 阅读全文
posted @ 2013-12-09 22:25 nx的封装 阅读(492) 评论(0) 推荐(0) 编辑