测试测试 | ✗ |
语言语言 | Obj-CObjective C |
许可证 | MIT |
发布最后发布 | 2015年10月 |
由Daniel Khamsing维护。
DKAuthenticationViewController 是一个简单的身份验证视图控制器,用于 iOS,可以采用电子邮件、密码或 Twitter(系统帐户选择器)进行身份验证。
将DKAuthenticationViewController文件夹中的文件添加到项目中。
DKAuthenticationViewController *authController = [[DKAuthenticationViewController alloc] init];
authController.twitter = YES; // Optional
authController.cellBackgroundColor = [UIColor lightGrayColor]; // Optional
authController.passwordLength = 5; // Validate password
authController.successBlock = ^void(id user, BOOL signup) {
NSLog(@"User %@ in 😎", signup?@"signed":@"logged");
};
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:authController];
[self presentViewController:navigationController animated:YES completion:nil]; // Should be presented modally with a navigation controller
DKAuthenticationViewController
有两个属性,使用协议解耦功能
hud
属性使用 DKHudProtocol
显示加载旋转器authentication
属性使用 DKAuthenticationProtocol
登录、注册、注销等...要使用协议,只需创建一个符合该协议的对象(实现其方法)并将其赋给 DKAuthenticationViewController
实例的属性(对于 DKHudProtocol
,您将创建一个实现 - hideInView:animationDuration
和 - showInView:animationDuration
的对象)。
DKAuthenticationViewController 包括一个示例项目。
DKAuthenticationViewController 使用 Apple 的 Accounts 框架和 DKTwitterReverseAuth 进行 Twitter 反向身份验证。
DKAuthenticationViewController 可在 MIT 许可下使用。有关更多信息,请参阅 LICENSE 文件。