CountryPicker icon indicating copy to clipboard operation
CountryPicker copied to clipboard

How can i show US in top of the list

Open chinnasamymca opened this issue 10 years ago • 3 comments

i want to show US and India for 1st and 2nd position in the picker list.

Can you help me out ?

Thanks, Chinna

chinnasamymca avatar May 12 '14 12:05 chinnasamymca

Check the note about subclassing at the bottom of the README file. It explains which methods to override to achieve this.

nicklockwood avatar May 12 '14 14:05 nicklockwood

Hi, can you provide the code for US and Indian in 1st and 2nd order ?

Thanks , Chinna

chinnasamymca avatar May 13 '14 04:05 chinnasamymca

Had the same question. here is the code:

+ (NSArray *)countryNames
{
    static NSMutableArray *_countryNames = nil;
    if (!_countryNames)
    {
        _countryNames = [[[self countryNamesByCode].allValues sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)] mutableCopy];
        [_countryNames insertObject:@"United States" atIndex:0];
        [_countryNames insertObject:@"India" atIndex:0];
    }
    return _countryNames;
}

sbiermanlytle avatar Oct 02 '16 22:10 sbiermanlytle