我有一个在 Xcode 5 中构建的应用程序,它使用 FXForms 来显示三个文本输入。切换到 Xcode 6 后,我现在看到了六个字段,最后三个标记为 Hash、Description 和 Debug Description。
// SGESettingsForm.h
#import <Foundation/Foundation.h>
#import "FXForms.h"
@interface SGESettingsForm : NSObject <FXForm>
@property (nonatomic, copy) NSString *baseURI;
@property (nonatomic, copy) NSString *apiKey;
@property (nonatomic, copy) NSString *apiSecret;
@end
只有一个视图与表单交互
@implementation SGESettingsViewController
- (id)init
{
self = [super init];
if (self)
{
self.form = [[SGESettingsForm alloc] init];
}
return self;
}
- (void)awakeFromNib
{
// setup form
self.form = self.formController.form = [[SGESettingsForm alloc] init];
self.form.baseURI = [SGESettingsStore baseURI];
self.form.apiKey = [SGESettingsStore apiKey];
self.form.apiSecret = [SGESettingsStore apiSecret];
// if no settings show alert with API instructions
if (![SGESettingsStore isSettingsValid]) {
[self showInstructions];
}
}
- (IBAction)dismiss:(id)sender
{
// resign first responder, fxform fields do not set their data bound values until you click out of them,
// this will set them on clicking the 'Done' button
[self.view endEditing:YES];
// save settings
[SGESettingsStore baseURI:self.form.baseURI
apiKey:self.form.apiKey
apiSecret:self.form.apiSecret];
// if valid settings exit to log view otherwise show instructions
if ([SGESettingsStore isSettingsValid]) {
[self.presentingViewController dismissViewControllerAnimated:YES
completion:NULL];
} else {
[self showInstructions];
}
}
//...
谢谢!