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

iphone – 在摆动图像上显示删除按钮并删除该特定图像

发布时间:2020-12-14 17:29:16 所属栏目:百科 来源:网络整理
导读:我在滚动视图中添加了图像.长期以来,我已经为所有图像提供了摆动动画. 我想在我们卸载任何类似的应用程序时,在 iphone的右上角显示删除按钮. - (void)startWobble {for (UIView *imgView in viewsInScrollView) { UIButton *deleteImgButton = [[UIButton al
我在滚动视图中添加了图像.长期以来,我已经为所有图像提供了摆动动画.
我想在我们卸载任何类似的应用程序时,在 iphone的右上角显示删除按钮.

- (void)startWobble {
for (UIView *imgView in viewsInScrollView) {
    UIButton *deleteImgButton = [[UIButton alloc] initWithFrame:CGRectMake(55,-7,12,12)];        
    [deleteImgButton setImage:[UIImage imageNamed:@"close_icon.png"] forState:UIControlStateNormal];
    [deleteImgButton addTarget:self action:@selector(deleteImage:) forControlEvents:UIControlEventTouchUpInside];
    [imgView addSubview:deleteImgButton];


    imgView.transform = CGAffineTransformRotate(CGAffineTransformIdentity,RADIANS(-5));        
    [UIView animateWithDuration:0.20
                          delay:0.0
                        options:(UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse)
                     animations:^ {
                         imgView.transform = CGAffineTransformRotate(CGAffineTransformIdentity,RADIANS(5));
                     }
                     completion:NULL
     ];
}
}
-(void)deleteImage : (id)sender {
     NSLog(@"Delete Image");
}

这里没有调用选择器….我该如何解决这个问题.. ???

解决方法

您可以在最初的所有自定义视图中添加带有TAG值的删除按钮,并将其隐藏.现在在 – (void)startWobble方法中,你只需使用他们的TAG就可以取消隐藏它们.

我已经以这种方式在我的一个应用程序中完成了.希望这会帮助你.

(编辑:李大同)

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

    推荐文章
      热点阅读