【发布时间】:2013-10-21 10:39:52
【问题描述】:
如果您需要输入城市名称,我有一个 UITextField。该城市名称链接到一个 url:例如 mywebsite/oslo
但是,当我进入纽约时,它不是一个正确的网址。我的网站/纽约 必须是这个http://www.website.com/New-York 如何制作一个 UITextField 替换空格:--> -
感谢您的帮助!
- (void)configureControls {
[self.activityIndicator stopAnimating];
[UIView animateWithDuration:1.5 animations:^{
if (self.weatherModel.lastLoadFailed) {
self.locationTextField.enabled = YES;
self.saveButton.hidden = NO;
self.activityIndicator.hidden = YES;
return;
}
self.settingsModel.location = self.locationTextField.text;
PWForecastModel *forecast = self.weatherModel.sevenDayForecast[0];
NSString *backgroundName = [PWHelper backgroundFileNameForConditionCode:forecast.conditions.conditionCode asDaytime:[[NSDate date] isDayTime]];
if (![[NSDate date] isDayTime]) {
[self styleControlsForDarkBackground];
}
self.backgroundImageView.image = [UIImage imageNamed:backgroundName];
self.locationLabel.text = [NSString stringWithFormat:@"%@",self.weatherModel.cityName];
}];
}
【问题讨论】:
标签: ios xcode uitextfield spaces