Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat could be overriding UIButton attributes from viewDidLoad?
    primarykey
    data
    text
    <p>I load some defaults and set <code>UIButton</code> customizations in my <code>viewDidLoad</code> method. The defaults load fine. However, the <code>UIButtons</code> do not get their customization.</p> <p>When I put the exact same <code>UIButton</code> code in an action button to trigger the customizations - it works great. I changed the button to "Custom" in the .xib.</p> <p>I feel like something is happening out of order and that is why the buttons do not launch with their mods.</p> <pre><code>- (void)viewDidLoad { lifeTotal.text = [[NSUserDefaults standardUserDefaults] objectForKey:@"bankKey"]; floatTot = [[NSUserDefaults standardUserDefaults] floatForKey:@"floatKey"]; dollaInt = [[NSUserDefaults standardUserDefaults] integerForKey:@"intKey"]; hourlyRate.text = [[NSUserDefaults standardUserDefaults] objectForKey:@"rateKey"]; rate = [[NSUserDefaults standardUserDefaults] integerForKey:@"rateInt"]; NSArray *buttons = [NSArray arrayWithObjects: self.start, self.stop, self.fbButton, self.clearLifeTotal,nil]; for(UIButton *btn in buttons) { // Set the button Text Color [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [btn setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted]; // Set default backgrond color [btn setBackgroundColor:[UIColor blackColor]]; // Round button corners CALayer *btnLayer = [btn layer]; [btnLayer setMasksToBounds:YES]; [btnLayer setCornerRadius:5.0f]; // Apply a 1 pixel, black border around Buy Button [btnLayer setBorderWidth:1.0f]; [btnLayer setBorderColor:[[UIColor blackColor] CGColor]]; } [super viewDidLoad]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload