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,开发)