Save UIButton state and load with NSUserDefaults
问题 I was wondering how to detect whether the button was hidden or not, and how much alpha was applied to it. Then, when viewDidLoad is called, these values can be applied to make the buttons the same state they were left in when the application closed. How can I code this? Thanks, James 回答1: If, as your title suggests, you want to use NSUserDefaults , then you can set them like this: -(void)saveButtonState:(UIButton*)button { NSUserDefaults defaults = [NSUserDefaults standardUserDefaults];