- 浏览: 2479079 次
- 性别:
- 来自: 苏州
文章分类
最新评论
-
jsntghf:
peio 写道这个怎么运行?Ruby On Rails的环境搭 ...
多文件上传之uploadify -
peio:
这个怎么运行?
多文件上传之uploadify -
往事如烟1:
我的项目是自己init了一个原始的project,之后将ver ...
React Native热部署之CodePush -
jsntghf:
<div class="quote_title ...
React Native热部署之CodePush -
往事如烟1:
我按照你的说明进行,发现app退出之后,在进入不正确,请问是什 ...
React Native热部署之CodePush
MagnifierView.h文件:
#import <Foundation/Foundation.h> @interface MagnifierView : UIView { UIView *viewref; CGPoint touchPoint; UIImage *cachedImage; } @property(nonatomic, retain) UIView *viewref; @property(assign) CGPoint touchPoint; @end
MagnifierView.m文件:
#import "MagnifierView.h" @implementation MagnifierView @synthesize viewref, touchPoint; - (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { self.backgroundColor = [UIColor clearColor]; } return self; } - (void)drawRect:(CGRect)rect { if(cachedImage == nil){ UIGraphicsBeginImageContext(self.bounds.size); [self.viewref.layer renderInContext:UIGraphicsGetCurrentContext()]; cachedImage = [UIGraphicsGetImageFromCurrentImageContext() retain]; UIGraphicsEndImageContext(); } CGImageRef imageRef = [cachedImage CGImage]; CGImageRef maskRef = [[UIImage imageNamed:@"loopmask.png"] CGImage]; CGImageRef overlay = [[UIImage imageNamed:@"loop.png"] CGImage]; CGImageRef mask = CGImageMaskCreate(CGImageGetWidth(maskRef), CGImageGetHeight(maskRef), CGImageGetBitsPerComponent(maskRef), CGImageGetBitsPerPixel(maskRef), CGImageGetBytesPerRow(maskRef), CGImageGetDataProvider(maskRef), NULL, true); CGImageRef subImage = CGImageCreateWithImageInRect(imageRef, CGRectMake(touchPoint.x - 18, touchPoint.y - 18, 36, 36)); CGImageRef xMaskedImage = CGImageCreateWithMask(subImage, mask); CGContextRef context = UIGraphicsGetCurrentContext(); CGAffineTransform xform = CGAffineTransformMake(1.0, 0.0, 0.0, -1.0, 0.0, 0.0); CGContextConcatCTM(context, xform); CGRect area = CGRectMake(touchPoint.x - 42, -touchPoint.y, 85, 85); CGRect area2 = CGRectMake(touchPoint.x - 40, -touchPoint.y + 2, 80, 80); CGContextDrawImage(context, area2, xMaskedImage); CGContextDrawImage(context, area, overlay); } - (void)dealloc { [cachedImage release]; [viewref release]; [super dealloc]; } @end
TouchReader.h文件:
#import <Foundation/Foundation.h> #import "MagnifierView.h" @interface TouchReader : UIView { NSTimer *touchTimer; MagnifierView *loop; } - (void) handleAction:(id)timerObj; @end
TouchReader.m文件:
#import "TouchReader.h" #import "MagnifierView.h" @implementation TouchReader - (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { touchTimer = nil; loop = nil; } return self; } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ touchTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(handleAction:) userInfo:touches repeats:NO]; } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ if(loop != nil){ [self handleAction:touches]; return; } [touchTimer invalidate]; touchTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(handleAction:) userInfo:touches repeats:NO]; } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ [touchTimer invalidate]; touchTimer = nil; [loop removeFromSuperview]; [loop release]; loop = nil; } - (void) handleAction:(id)timerObj { NSSet *touches; if([timerObj isKindOfClass:[NSSet class]]){ touches = [timerObj retain]; }else{ touches = [[timerObj userInfo] retain]; } if(touchTimer != nil){ [touchTimer invalidate]; touchTimer = nil; } if(loop == nil){ loop = [[MagnifierView alloc] initWithFrame:self.bounds]; loop.viewref = self; [self addSubview:loop]; } UITouch *touch = [touches anyObject]; loop.touchPoint = [touch locationInView:self]; [loop setNeedsDisplay]; [touches release]; } - (void)dealloc { [super dealloc]; } @end
示例图:
发表评论
-
Error watching file for changes: EMFILE
2016-12-15 11:57 1240执行npm start后报错: Error watc ... -
CocoaPods升级1.1.1报错
2016-12-15 08:39 743ERROR: While executing gem .. ... -
Visual Studio Code运行React Native报错
2016-06-13 09:43 1562React Native:0.27.2 React:15 ... -
React Native 0.27.2编译报错this._nativeModule.addListener is not a function
2016-06-12 15:21 3797React Native:0.27.2 React:15 ... -
Unable to resolve module ReactDefaultPerf from
2016-06-02 13:04 2736package.json信息如下: "reac ... -
React Native 0.26.2编译报错Undefined symbols for architecture x86_64
2016-05-26 11:15 1952React Native:0.26.2 React:15. ... -
Failed to update auto layout status: Failed to load designables from path (null)
2016-04-05 22:11 1671确保CocoaPods是0.36.1以上版本,然后在podf ... -
集成微信支付出现Undefined symbols for architecture x86_64错误
2016-03-21 13:22 1687Undefined symbols for architec ... -
React Native热部署之CodePush
2016-01-10 22:27 6136本文使用的环境是Mac OS 10.11.1、Xcode ... -
浅谈React Native中的FlexBox布局
2015-11-17 18:38 4275React Native通过一个基于FlexBox的布局引 ... -
React Native之构建一个简单的列表页
2015-10-23 14:45 2101本文中我们将创建一个简单的电影应用,这个应用将从Rotten ... -
React Native之环境搭建
2015-10-20 16:30 1396本文使用的环境是Mac O ... -
获取图片属性的方法
2015-10-18 20:43 3085很多时候我们需要获 ... -
NSCache的下标用法
2015-09-18 00:19 1173NSCache类和NSDictionary类很相似,也提供 ... -
如何给category添加属性
2015-08-16 10:41 646主要是使用了runtime中的associative机制。 ... -
UITableView的两种重用Cell方法的区别
2015-08-10 13:07 16069UITableView中有两种重用Cell的方法: - ... -
SDImageCache.m报错Unused variable 'fileName'
2015-08-04 21:56 1137GCC手册中的相关解释: unused:This att ... -
Swift调用Objective-C
2015-07-13 23:33 1180Swift调用Objective-C需要一个名为<工程 ... -
使用GCD实现倒计时
2015-07-24 21:47 1048__block int timeout = 60; // ... -
导航栏加分割线的实现
2015-07-01 22:00 1695self.view.backgroundColor = [U ...
相关推荐
Untiy版本:2019.4.10 主要功能是模拟出真实放大镜效果,使用Unity自带Camera以及Render Texture实现(无代码),资源为Prefab,拖拽到场景中即可使用,资源本身含放大镜模型、放大镜功能
使用react写一个仿图片放大镜效果使用react写一个仿图片放大镜效果
简单实用jQuery图片放大镜效果
放大镜效果。运行本程序后applet容器中会出现一幅图片,随着鼠标在图片上移动,处于放大框内的图像就会被放大
仿淘宝放大镜效果,分享一下。
js淘宝放大镜效果代码
jquery实现的图片滑动并带有放大镜效果代码
jquery放大镜效果
运用 JavaScript以及HTML5实现三种放大镜的效果,包括圆形放大镜效果,直接矩形放大镜效果以及仿淘宝或者京东商品展示放大镜效果。
仿淘宝js放大镜效果 核心代码 malmg.onmouseover = function(){ showimg.style.display = "block"; bigimg.style.display = "inline"; show_half = showimg.offsetHeight/2; maxWidth = smalmg.clientWidth - ...
仿京东放大镜效果,网页常用 效果非常好 我多次应用到客户网站的
jquery手机屏幕放大镜效果
商城图片放大镜效果源码,10种效果,希望对你们有用
使用jquer实现类似于淘宝上的图片放大镜效果
图片放大镜效果示例,封装了js,可以很方便的调整,直接浏览器打开可看到效果,再根据自己的需求做相应调整。
jQuery放大镜效果仿淘宝放大效果 仿淘宝产品预览放大效果
适合小白模仿的H5+JS+CSS模仿JD商品详情页放大镜效果,可以熟练掌握鼠标经过和鼠标移动事件
购物商城放大镜 jQuery 做的简单实例,通俗易懂,jQuery 商城放大镜 类似淘宝商品放大镜
仿放大镜效果.
jQuery图片放大镜效果