0

Currently I have a BOOL in runtime attributes for my view controller that I use to see if my view controller should add a button to the navigation bar programmatically. I was told that to access the attribute in the code, you add a property with the same name like this:

@interface MyViewController

@property (nonatomic, assign) BOOL showButton;
@end

@implementation

@synthesize showButton = _showButton;


-(void)viewDidLoad {
    [super viewDidLoad];
    if (_showButton) {
        //show button
    }
}
@end

And this does work in iOS 8 and 9, but for some reason in the simulator, iOS 7 does not read the Boolean and it's always set to false.

I feel like this is a serious enough problem that someone should have an answer but Google or the search results on SO didn't seem to have results for this.

I really appreciate the help!

UPDATE: I set the value in the Storyboard.

George Urick
  • 135
  • 10
  • Where and when do you set the property's value? – rmaddy Aug 21 '15 at 20:53
  • In Storyboard on the viewController. – George Urick Aug 21 '15 at 21:20
  • It's possible this will help you ... http://stackoverflow.com/questions/15007542/how-to-access-user-defined-runtime-attribute-from-the-sender-object and ... http://stackoverflow.com/questions/14792238/uiviews-border-color-in-interface-builder-doesnt-work – Fattie Aug 21 '15 at 21:42
  • Thanks. I found out that it didn't have to do with iOS 7. My simulator refused to update the storyboard changes I made. I had to uninstall/reinstall for it to see the changes. – George Urick Aug 22 '15 at 01:41

0 Answers0