我需要在該領域已被編輯恢復的NSTextField的舊內容,它現在是空的。如何恢復NSTextField中的舊內容?
我目前正在顯示一個彈出窗口,說該字段不能爲空。
- (IBAction)checkTitleField:(id)sender
{
if ([[titleField stringValue] isEqualToString:@""]) {
NSAlert * alert = [NSAlert alertWithMessageText:@"Title can't be empty"
defaultButton:@"OK"
alternateButton:nil
otherButton:nil
informativeTextWithFormat:@"Please enter a title."];
[alert beginSheetModalForWindow:self.window
modalDelegate:self
didEndSelector:nil
contextInfo:nil];
return;
}
}
但是我不能當彈出被駁回恢復領域的以前的內容:當字段失去集中被觸發的方法。
感謝