2

In my application I have four buttons and a few text labels. The text in the labels are defined through interface builder. I'm bad with words so I hope the code below is clear enough to point out what I'm trying to do.

- (void)viewDidLoad 
{

    [super viewDidLoad];

    //Default view loaded as defined in Interface Builder

}

- (IBAction)button_1_Pressed:(id)sender {

    // Programmatically Change text in Labels
}

- (IBAction)button_2_pressed:(id)sender {

    // Programmatically Change text in labels

}

- (IBAction)button_3_pressed:(id)sender {

    // Programmatically Change text in labels
}

- (IBAction)button_4_pressed:(id)sender {

    // Change text in labels back to the values when the view first loaded.
    // That is, to the text defined in Interface builder instead of changing 
    // it back programmatically. 
}

Or perhaps is there a way to reset/'restart' the view when button 4 is pressed?

4

2 回答 2

1

存储它,使用它。

-(void)viewDidLoad {
    self.originalText = self.textField.text;
}

-(void)restore {
    self.textField.text = self.originalText;
}
于 2013-09-13T07:48:51.957 回答
0

Reload获得原始文本的视图。

于 2013-09-13T10:55:21.850 回答