图片点击放大,再次点击返回原视图.完美封装,一个类一句代码即可调用.IOS完美实现
转载请声明源地址点击打开链接
图片点击放大,再次点击返回原视图.完美封装,一个类一句代码即可调用.完美实现
创建了一个专门用于放大图片的类,以下为.***件
@interface SJAvatarBrowser : NSObject
* @brief 浏览头像
oldImageView
头像所在的imageView
+(void)showImage:(UIImageView*)avatarImageV
@end以下为.m文件
#import "SJAvatarBrowser.h"
static CGR
@implementation SJAvatarBrowser
+(void)showImage:(UIImageView *)avatarImageView{
UIImage *image=avatarImageView.
UIWindow *window=[UIApplication sharedApplication].keyW
UIView *backgroundView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
oldframe=[avatarImageView convertRect:avatarImageView.bounds toView:window];
backgroundView.backgroundColor=[UIColor blackColor];
backgroundView.alpha=0;
UIImageView *imageView=[[UIImageView alloc]initWithFrame:oldframe];
imageView.image=
imageView.tag=1;
[backgroundView addSubview:imageView];
[window addSubview:backgroundView];
UITapGestureRecognizer *tap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(hideImage:)];
[backgroundView addGestureRecognizer: tap];
[UIView animateWithDuration:0.3 animations:^{
imageView.frame=CGRectMake(0,([UIScreen mainScreen].bounds.size.height-image.size.height*[UIScreen mainScreen].bounds.size.width/image.size.width)/2, [UIScreen mainScreen].bounds.size.width, image.size.height*[UIScreen mainScreen].bounds.size.width/image.size.width);
backgroundView.alpha=1;
} completion:^(BOOL finished) {
+(void)hideImage:(UITapGestureRecognizer*)tap{
UIView *backgroundView=tap.
UIImageView *imageView=(UIImageView*)[tap.view viewWithTag:1];
[UIView animateWithDuration:0.3 animations:^{
imageView.frame=
backgroundView.alpha=0;
} completion:^(BOOL finished) {
[backgroundView removeFromSuperview];
引入此类之后,为自己需要放大的imageView添加tap手势
UITapGestureRecognizer *tap
= [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(magnifyImage)];
[self.imageView addGestureRecognizer:tap];- (void)magnifyImage
NSLog(@"局部放大");
[SJAvatarBrowser showImage:self.imageView];//调用方法
}转载请声明源地址http://blog.csdn.net/u/article/details/
(window.slotbydup=window.slotbydup || []).push({
id: '2467140',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467141',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467142',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467143',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467148',
container: s,
size: '1000,90',
display: 'inlay-fix'- 或用以下帐号直接登录 -
“发张照片看一下”苹果Siri弹出不雅图 网友:太污了
来源:中国网作者:
今天下午突然火起来的“发张照片看一下”,据传说是苹果的漏洞。
小编从微博上看到,不少网友都在说,只要对着Siri说一句“发张照片看一下”,就会有“惊喜”出现。
欢迎关注“南方新闻网”公众号(微信上长按二维码识别 )
编辑:李杰
请文明发言,还可以输入140字
您的评论已经发表成功,请等候审核
小提示:您要为您发表的言论后果负责,请各位遵守法纪注意语言文明
新闻关键词
为进一步推动广东省大学生深入学习《习***总书记系列重要讲话读本》(2016年版),增强中国特色社会主义的道路自信、理论自信、制度自信,为实现中华民族伟大复兴的"中国梦"贡献智慧和力量,广东省委宣传部、南方网决定在全省普通高等学校大学生中开展"党中央治国理政新理念新思想新战略知识竞赛"活动。为什么iPhone上看相册照片还要加载_百度知道为什么明明是我自己手机拍的照片,看的时候还要缓冲下载,以前没事刚刚发现的。手机是iphone6_百度知道苹果园为iOS用户提供和下载,最新的、、、等,分享最权威的资讯、、及解决办法,拥有最火爆的,苹果园一家专注解决iOS所求的网站。