BDVCountryNameAndCode手機(jī)號(hào)碼前綴控件
BDVCountryNameAndCode 是簡(jiǎn)單建議一個(gè)手機(jī)號(hào)碼前綴的控件,無(wú)需詢問(wèn)地理位置服務(wù)就能訪問(wèn)用戶城市。
如何使用
將 BDVCountryNameAndCode.h 和 BDVCountryNameAndCode.m 添加到項(xiàng)目。
獲取用戶當(dāng)前語(yǔ)言環(huán)境的前綴:
BDVCountryNameAndCode *BDVCountryNameAndCode = [[BDVCountryNameAndCode alloc] init]; NSString *prefixOfCurrentLocale = [BDVCountryNameAndCode prefixForCurrentLocale]; // Returns "+1" for Canada
以相同的方式獲取當(dāng)前國(guó)家的名稱:
BDVCountryNameAndCode *BDVCountryNameAndCode = [[BDVCountryNameAndCode alloc] init]; NSString *nameOfCurrentLocale = [BDVCountryNameAndCode countryNameForCurrentLocale]; // Returns "Canada"
獲取用戶當(dāng)前語(yǔ)言環(huán)境的圖像標(biāo)志:
BDVCountryNameAndCode *BDVCountryNameAndCode = [[BDVCountryNameAndCode alloc] init]; UIImage *flagOfCurrentLocale = [BDVCountryNameAndCode countryFlagForCurrentLocale]; // Returns UIImage
評(píng)論
圖片
表情
