加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

iphone – 在UIView中存储其他相关信息

发布时间:2020-12-15 01:46:57 所属栏目:百科 来源:网络整理
导读:我一直在阅读很多关于SO的手势识别器 – 并且设法编写了一个工作代码,当在UIImage上识别出长按时,会出现一个操作表: { ... UILongPressGestureRecognizer *longPressWall = [[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(d
我一直在阅读很多关于SO的手势识别器 – 并且设法编写了一个工作代码,当在UIImage上识别出长按时,会出现一个操作表:

{ ...
 UILongPressGestureRecognizer *longPressWall = [[[UILongPressGestureRecognizer alloc]
                                                               initWithTarget:self     action:@selector(deleteImage:)] autorelease];
                     longPressWall.minimumPressDuration = 0.4;
                     l.userInteractionEnabled=YES;
                     [l addGestureRecognizer:longPressWall];
... }


-(void)deleteImage:(UILongPressGestureRecognizer*)sender { 
    if(UIGestureRecognizerStateBegan == sender.state) {
        UIActionSheet *as = [[UIActionSheet alloc] initWithTitle:@"" delegate:self cancelButtonTitle:@"Close" destructiveButtonTitle:@"Delete Screenshot" otherButtonTitles: nil];
        [as showInView:masterView];
        [as release];
    }
}

因此,在这种情况下,将信息发送到Selector deleteImage:有点棘手.
我想在调用deleteImage时向服务器发送HTTP请求,因此我需要从视图中获取一些信息.

无论如何将信息存储到UIImageView并从sender.view.myinfo(例如)中检索它?

谢谢!

解决方法

显而易见的方法是使用tag属性.如果您需要更多信息,您可以随时继承UIImageView并添加额外的属性.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读