Note that there are some explanatory texts on larger screens.

plurals
  1. POSave user settings in iPhone/iPad app
    primarykey
    data
    text
    <p>In my app I let users to pick a colour of background, tint and text. How can I save this settings after the app is closed? I mean when user again starts the app he wants to see the background, tint and text colour from previous usage.</p> <p>This is how I have set the colours.</p> <pre><code>self.BackgroundView.backgroundColor = [UIColor colorWithRed:248.0/255.0 green:242.0/255.0 blue:229.0/255.0 alpha:1.0]; [[[self navigationController] navigationBar] setTintColor:[UIColor colorWithRed:103.0/255.0 green:10.0/255.0 blue:10.0/255.0 alpha:1.0]]; self.QuoteText.textColor = [UIColor colorWithRed:131.0/255.0 green:21.0/255.0 blue:21.0/255.0 alpha:1.0]; </code></pre> <p>Trying to solve by following Greg's (probably the right) answer gives SIGABRT error by clicking on following button:</p> <pre><code>- (IBAction)setcolor:(id)sender { UIColor *backgroundColor = [UIColor colorWithRed:230.0/255.0 green:230.0/255.0 blue:220.0/255.0 alpha:1.0]; self.BackgroundView.backgroundColor = backgroundColor; UIColor *tintColor = [UIColor colorWithRed:129.0/255.0 green:165.0/255.0 blue:148.0/255.0 alpha:1.0]; [[[self navigationController] navigationBar] setTintColor:tintColor]; UIColor *textColor = [UIColor colorWithRed:0.0/255.0 green:98.0/255.0 blue:139.0/255.0 alpha:1.0]; self.QuoteText.textColor = textColor; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; [defaults setObject:backgroundColor forKey:@"BACKGCOLOR"]; [defaults setObject:tintColor forKey:@"TINTCOLOR"]; [defaults setObject:textColor forKey:@"TEXTCOLOR"]; [defaults synchronize]; } </code></pre>
    singulars
    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