ios获取国家名称,非常好用

获取过加的名称,直接上代码

代码不多,好理解

NSMutableArray *countriesArray = [[NSMutableArray alloc] init];

    
    NSLocale *locale = [NSLocale currentLocale];
    
    NSArray *countryArray = [NSLocale ISOCountryCodes];
    for (NSString *countryCode in countryArray)
    {
        NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
        
        NSString *displayNameString = [locale displayNameForKey:NSLocaleCountryCode value:countryCode];
        [countriesArray addObject:displayNameString];
        [pool release];
        
    }

你可能感兴趣的:(ios-便捷积累)