当前位置:编程学习 > wap >>

UIImageView响应点击事件

NSString *URL =@"http://xxx.jpg";

    NSData *imageData = [[NSDataalloc]initWithContentsOfURL:[NSURLURLWithString:URL]];

    UIImage *image=[[UIImagealloc] initWithData:imageData];

    [imgADBanner setImage:image];

    UITapGestureRecognizer *singleTap = [[UITapGestureRecognizeralloc] initWithTarget:selfaction:@selector(handleSingleTap:)];

    [imgADBanneraddGestureRecognizer:singleTap];

    [singleTap release];

    [imageData release];


- (void)handleSingleTap:(UIGestureRecognizer *)gestureRecognizer { 

    //do something....

}


摘自 sql_help的专栏
补充:移动开发 , IOS ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,