【发布时间】:2013-12-25 07:09:55
【问题描述】:
在我的应用程序中,我有一个带有 UIButton 子视图的 UIView。在 viewDidLoad 我隐藏了一个自定义视图。当用户单击某个按钮时,视图应与该按钮一起出现。它工作正常,但按钮不再可选择。动画结束后我无法再与它互动。有什么问题?这是代码。 ViewDidLoad:
view = [[UIView alloc] initWithFrame:CGRectMake(-150, 0, 150, [[UIScreen mainScreen] bounds].size.height)];
[view setBackgroundColor:[UIColor clearColor]];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:view.frame];
imageView.image = effectImage;
[view addSubview:imageView];
[self.view addSubview:view];
UIButton *remove = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 170, [[UIScreen mainScreen] bounds].size.height)];
[remove setBackgroundColor:[UIColor whiteColor]];
[self.view addSubview:remove];
另一种方法的动画:
[UIView animateWithDuration:0.5 animations:^{
[view setFrame:CGRectMake(150, 0, 150, [[UIScreen mainScreen] bounds].size.height)];
}];
我个人没有发现任何问题。有什么帮助吗?
【问题讨论】:
-
您是否将目标添加到删除按钮?否则,任何点击都不起作用。
-
是的,我做到了。不工作。
标签: ios objective-c uiview