我的 xib 文件中有一个条形按钮项。
。H:
@property (nonatomic, retain) IBOutlet UIBarButtonItem *toolbarButton;
米:
UIButton *aboutToolbarButton = [UIButton buttonWithType:UIButtonTypeCustom];
[aboutToolbarButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[aboutToolbarButton setTitle:@"about" forState:UIControlStateNormal];
aboutToolbarButton.titleLabel.font = [UIFont fontWithName:@"Helvetica" size:12.0f];
[aboutToolbarButton.layer setCornerRadius:4.0f];
[aboutToolbarButton.layer setMasksToBounds:YES];
[aboutToolbarButton.layer setBorderWidth:1.0f];
[aboutToolbarButton.layer setBorderColor: [[UIColor grayColor] CGColor]];
aboutToolbarButton.frame = CGRectMake(0.0, 100.0, 60.0, 30.0);
[aboutToolbarButton addTarget:self action:@selector(getToUserSettingsViewController) forControlEvents:UIControlEventTouchUpInside];
self.toolbarButton = [[UIBarButtonItem alloc] initWithCustomView:aboutToolbarButton];
我用按钮连接到文件所有者,但它不起作用,请帮助我。
非常感谢!