我在滚动视图中添加了图像。在长按时,我为所有图像提供了摆动动画。当我们卸载任何类似的应用程序时,我想在每个图像的右上角显示删除按钮,就像在 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");
}
这里没有调用选择器....我该如何解决这个..???