zoukankan      html  css  js  c++  java
  • 新浪博客中放大图片的做法

    在自定义cell中子的UIImageview添加手势,单击手势触发下面的事件

     
    UIImageview  _statuImage=[[UIImageView alloc] init];
            _statuImage.userInteractionEnabled=YES;
            [self.contentView addSubview:_statuImage];
            _statuImage.contentMode=UIViewContentModeScaleAspectFit;
            [_statuImage release];
            
    
                UITapGestureRecognizer *tap=[[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(openPic:)] autorelease];
                [_statuImage addGestureRecognizer:tap];
    -(void)openPic:(UITapGestureRecognizer *)tap{
        
        
            [UIView beginAnimations:@"present" context:nil];
            [UIView setAnimationDuration:0.25];
                    
            CGRect r = [[UIApplication sharedApplication] keyWindow].frame;
        
            alphaView = [[UIView alloc] initWithFrame:r];
            alphaView.backgroundColor = [UIColor colorWithRed:0.95 green:0.95 blue:0.95 alpha:1];
            alphaView.alpha = 0.95;
           [[[UIApplication sharedApplication] keyWindow] addSubview:alphaView];
           [alphaView release];
        
            UITapGestureRecognizer *closeTap=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(closePic)];
            [alphaView addGestureRecognizer:closeTap];
            [closeTap release];
    
            EGOImageView *img=[[EGOImageView alloc] initWithFrame:alphaView.bounds];
            [alphaView addSubview:img];
            [img release];
        
            [UIView commitAnimations];
        
           Status *frame=self.cellData.Mystaus;
            if (tap.view==_statuImage) {
                if (frame.originalImageUrl) {
                        [img setImageURL:[NSURL URLWithString:frame.originalImageUrl]];
                }
    
            }
            if (tap.view==_retweetStatusimg) {
                if (frame.retweetedStatus.originalImageUrl) {
                     [img setImageURL:[NSURL URLWithString:frame.retweetedStatus.originalImageUrl]];
                }
    
            }
    
    }
    
    
    -(void)closePic{
      
        [UIView beginAnimations:@"present" context:nil];
        [UIView setAnimationDuration:0.25];
        alphaView.frame = CGRectMake(0, 600, 320, 600);
        [UIView commitAnimations];
        [alphaView removeFromSuperview];
        
      
    }
  • 相关阅读:
    无向图的双连通分量
    以管理员身份运行软件cmd命令
    异或
    递推求解DAG最长路径长度及最长路径条数
    有向图转强连通图最少加边数
    Tarjan强连通分量(scc)
    uni封装request请求
    生命周期
    页面路由,以及传值
    WXS 模块
  • 原文地址:https://www.cnblogs.com/gcb999/p/3343087.html
Copyright © 2011-2022 走看看