【发布时间】:2016-03-28 22:16:34
【问题描述】:
我有以下视图层次结构:导航控制器,在其中我推送了另一个视图控制器,其中包含 UITableView 和单元格中的自定义 UIButtons。我有另一个视图控制器(MyCustomViewController2),我想用动画显示所有这些东西。
但我对这种层次结构感到困惑,我不知道如何在我的自定义 UIButton 类中覆盖 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 方法。我到目前为止的代码是:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
MyCustomViewController2 *myVC = [[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"MyVC"];
[self.window addSubview: myVC.view];
}
但这太糟糕了!而且我没有任何动画,我应该删除它以删除。接下来我可以尝试什么?
【问题讨论】:
标签: objective-c uiview uiviewcontroller uibutton uiview-hierarchy