我在导航栏中有一个按钮和一个搜索字段,我通过一个类的代码为所有视图添加了一个新按钮。
问题是:使用按钮视图,另一个按钮和添加故事板的搜索字段不是更可触摸且不起作用。
UIImage * buttonImage = [UIImage imageNamed:@"chat-notify.png"];
button = [UIButton buttonWithType:UIButtonTypeCustom];
[button addTarget:self
action:@selector(goChat)
forControlEvents:UIControlEventTouchDown];
//[button setTitle:@"1" forState:UIControlStateNormal];
button.frame = CGRectMake(280.0, 25.0, 30.0, 30.0);
[button setBackgroundImage:buttonImage forState:UIControlStateNormal];
[self.view addSubview:button];
然后在控制器中:
notificationViewController* notification = [[notificationViewController alloc]init];
//[notification methodA];
[notification makeButtonNotification];
[self.view addSubview:notification.view];
有谁知道我的错误在哪里?
谢谢