zl程序教程

您现在的位置是:首页 >  移动开发

当前栏目

iOS-国家代码选择功能github开源分享

iosGitHub开源代码 功能 分享 选择 国家
2023-09-11 14:14:09 时间

三行代码集成国家区号选择功能

功能执行效果如图:
这里写图片描写叙述

开源链接:
https://github.com/qxuewei/XWCountryCode

用法:

1.导入XWCountryCode类

2.在须要选择国家代码的事件中

 XWCountryCodeController *CountryCodeVC = [[XWCountryCodeController alloc] init];
    //CountryCodeVC.deleagete = self;
    //block
    [CountryCodeVC toReturnCountryCode:^(NSString *countryCodeStr) {
        //在此处实现终于选择后的界面处理
        [self.countryCodeLB setText:countryCodeStr];
    }];
    [self presentViewController:CountryCodeVC animated:YES completion:nil];

界面传值提供了代理和block两种方式,自由选择