¿Cómo se establece el texto en un NSTextField?
Estoy tratando de establecer el texto en un NSTextField, pero los métodos -setStringValue:
y -setTitleWithMnemonic:
no están funcionando. Alguna idea?
6 answers
setStringValue:
es la manera de hacerlo. Debe asegurarse de que su toma de corriente esté configurada correctamente. (En el depurador, asegúrese de que la variable textfield no sea null.)
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-04-29 12:14:47
Simplemente haga algo como esto:
myLabel.stringValue = @"My Cool Text";
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-04-18 07:08:57
Solo myLabel.stringValue = "MY TEXT"
funciona aquí, usando Swift y Xcode 6.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-07-14 02:19:33
Swift 4
self.yourTextField.stringValue = "Your_Value"
Nota: Obtener valor de self.Yourstextfield.stringValue en que recibirá el mensaje de advertencia es decir, Para evitar este tipo de advertencia se puede utilizar de esta manera (forma sugerida)
DispatchQueue.main.async {
your code ...
}
O también refiérase a esto .
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-12-13 17:05:08
Objetivo:
[label setStringValue: @"I am a label"];
El código original que uso en mi código para mostrar la versión de la aplicación es:
[lblVersion setStringValue:[NSString stringWithFormat:@"v%@", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]]];
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-03-30 13:11:19
Solo haz esto
[textField setString:@"random"];
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-06-02 01:08:40