根据某一个字符截取字符串的某一段,获取前一段,获取后一段,给两个控件赋值

XWCountryCodeController *CountryCodeVC = [[XWCountryCodeController alloc] init];

//block

[CountryCodeVC toReturnCountryCode:^(NSString *countryCodeStr) {

//[self.countryCodeLB setText:countryCodeStr];

NSArray *array =  [countryCodeStr componentsSeparatedByString:@"+"];

[self.topBtn setTitle:array[0] forState:UIControlStateNormal];

NSRange range = [countryCodeStr rangeOfString:@"+"];

NSString *str2 = [countryCodeStr substringFromIndex:range.location];

[self.numberLabel setText:str2];

}];

你可能感兴趣的:(根据某一个字符截取字符串的某一段,获取前一段,获取后一段,给两个控件赋值)