我有一个自定义 UIView 用于显示弹出框(在 iPhone 上)。在弹出窗口中有一些 UIButtons,我需要从 ViewController 的类(不是 UIView 的类,而是显示 UIView 的视图)中调用方法。
我该如何正确设置?
位于自定义 UIView 类中的 UIView 按钮代码:
UIButton *logoutButton = [UIButton buttonWithType:UIButtonTypeCustom];
[logoutButton setTitle:@"Logout" forState:UIControlStateNormal];
[logoutButton setFrame:CGRectMake(0, 0, content.frame.size.width, 44)];
[logoutButton addTarget:self.superview.superview action:@selector(logout) forControlEvents:UIControlEventTouchUpInside];
[logoutButton setBackgroundImage:redImage forState:UIControlStateNormal];
[logoutButton setBackgroundImage:redImageHighlight forState:UIControlStateHighlighted];
[logoutButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[content addSubview:logoutButton];