iOS_23_undress Girl
2015-07-30 19:22
281 查看
最后效果图:
关键代码例如以下:
关键代码例如以下:
// // BeyondViewController.h // 24_showGirl // // Created by beyond on 14-8-26. // Copyright (c) 2014年 com.beyond. All rights reserved. // #import <UIKit/UIKit.h> @interface BeyondViewController : UIViewController @property (nonatomic,weak) IBOutlet UIImageView *clothes; @end
// // BeyondViewController.m // 24_showGirl // // Created by beyond on 14-8-26. // Copyright (c) 2014年 com.beyond. All rights reserved. // #import "BeyondViewController.h" @interface BeyondViewController () { BOOL canEarse; } @end @implementation BeyondViewController // 触摸開始 -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; // 假设触摸点落在ClothesImgView上面 if([touch view]==_clothes) { canEarse = YES; } } // 触摸进行中 -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; if(canEarse) { // 获得触摸点的坐标 CGPoint currentPoint = [touch locationInView:_clothes]; // 开启上下文 UIGraphicsBeginImageContext(self.clothes.frame.size); // 将原图画到上下文中,以便进行像素处理 [_clothes.image drawInRect:_clothes.bounds]; // 清除触摸点附近区域的一些像素 CGContextClearRect (UIGraphicsGetCurrentContext(), CGRectMake(currentPoint.x, currentPoint.y, 30, 30)); // 又一次画上去 _clothes.image = UIGraphicsGetImageFromCurrentImageContext(); // 关闭上下文 UIGraphicsEndImageContext(); } } // 触摸结束 -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { canEarse = NO; } @end
相关文章推荐
- iOS与服务器的对接
- iOS支付宝支付步骤
- iOS KVC 概述
- iOS开发笔记--Layer 图层圆角、边框 、底纹其他常用操作
- 0043 iOS完整学习路线 Xmind源文件
- ios8新特性widget开发
- iOS开发 - SDWebImage使用(一个可管理远程图片加载的类库)
- iOS 修改状态栏字体的颜色
- 第三方库
- 关情纸尾-----关于最近学习iOS开发的一些总结(一)
- 开源 iOS 项目分类索引大全
- iOS 工程依赖---静态链接库
- IOS第四天(6:答题区按钮点击和乱序)
- iOS 实时定位功能
- iOS 判断GPS是否开启
- ios 图片自动轮播
- IOS第四天(5:创建备份区按钮和判断结果)
- iOS开发中遇到的bug
- iOS真机上的EXC_ARM_DA_ALIGN问题
- [内存管理] 内存五大分区