Die Verwaltung UITextField.text-Eigenschaft

Gut, ich habe ein UITextField.

Innen es ist eine Eigenschaft, die UITextField.text.

Ist es ok zu tun:

//Assume we have UITextField * tf somewhere..
//now set its text..
tf.text = [ [ NSString alloc ] initWithUTF8String:"Init'd with utf8" ] ;

Mein problem mit diesem Speicher. Was passiert auf den alten Wert der UITextField-text-Eigenschaft.

Nicht Sie zu tun haben:

//maintain reference to old NSString
NSString * oldTfText = tf.text ;

//set the value to the new value you want
tf.text = [ [ NSString alloc ] initWithUTF8String:"Init'd with utf8" ] ;

//release the old NSString now..
[ oldTfText release ] ;

Ich bin immer noch denken, memory mgmt als ich in der normalen C., das könnte der Fehler hier.

InformationsquelleAutor bobobobo | 2009-11-02
Schreibe einen Kommentar