Objective c Can';我不能在标题栏上启用UIButton
我需要在标题栏中启用一个按钮。而且这段代码没有启用它。知道为什么吗Objective c Can';我不能在标题栏上启用UIButton,objective-c,uibutton,Objective C,Uibutton,我需要在标题栏中启用一个按钮。而且这段代码没有启用它。知道为什么吗 TitleBar.m @property (weak, nonatomic) IBOutlet UIButton *homeButton; -(void) shouldShowHomeButton:(BOOL)shouldShow { self.homeButton.enabled=shouldShow; } OtherViewController { TitleBarViewController *titleBarCont
TitleBar.m
@property (weak, nonatomic) IBOutlet UIButton *homeButton;
-(void) shouldShowHomeButton:(BOOL)shouldShow
{
self.homeButton.enabled=shouldShow;
}
OtherViewController
{
TitleBarViewController *titleBarController = [[TitleBarViewController alloc]init];
[titleBarController shouldShowHomeButton:YES];
}
我在-(void)shouldShowHomeButton:(BOOL)shouldShow中放了一个断点,它就在那里。但是不更新按钮,这里是启用的属性,希望这对您有所帮助
@property(非原子,getter=isEnabled)BOOL已启用
//默认值是YES。如果否,则忽略触摸
方法名称应显示HomeButton
表明您所说的是使按钮可见,而不是启用它。如果是这种情况,那么您需要将按钮的hidden
属性设置为YES。我需要启用它,请忽略方法名称