DXCountryCode
国家和地区码选择控制器,支持以 present 或 push 方式跳转,几行代码即可完成。适配 iPhone 和 iPad。如果对默认效果不满意,也支持各种自定义。
效果演示:
示例
要运行示例项目,请克隆仓库,然后首先从示例目录中运行 pod install
。
需求
安装
DXCountryCode 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod 'DXCountryCode'
如何使用
展示方式
DXCountryCodeController *countryCodeVC = [[DXCountryCodeController alloc] initWithCountryCode:@"86"];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:countryCodeVC];
countryCodeVC.returnCountryCodeBlock = ^(NSString *countryName, NSString *code) {
NSLog(@"countryName:%@, code:%@",countryName,code);
};
[self presentViewController:nav animated:YES completion:nil];
推送方式
DXCountryCodeController *countryCodeVC = [[DXCountryCodeController alloc] initWithCountryCode:@"86"];
countryCodeVC.returnCountryCodeBlock = ^(NSString *countryName, NSString *code) {
NSLog(@"countryName:%@, code:%@",countryName,code);
};
[self.navigationController pushViewController:countryCodeVC animated:YES];
作者
Jackdx, [email protected]
授权
DXCountryCode可在MIT授权许可下使用。有关更多信息,请参阅LICENSE文件。