如果您需要输入城市名称,我有一个 UITextField。该城市名称链接到一个 url:例如 mywebsite/oslo
但是,当我进入纽约时,它不是一个正确的网址。mywebsite/new york 它必须是这个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];
}];
}