In order for the button to be accessible from other methods, you need to assign it to an instance variable (directly or through a property), and not assign it to a local variable. The correct way to declare a property is
@property(nonatomic, strong) UILabel *nameLabel;
which can then be assigned for use
self.nameLabel = [[UILabel alloc] init...];
Later you can say
self.nameLabel.hidden = YES;
and it should work.
source share