さて、私はUITextFieldを持っています。
その中には、プロパティUITextField.textがあります。
行っても大丈夫ですか:
// Assume we have UITextField * tf somewhere..
// now set its text..
tf.text = [ [ NSString alloc ] initWithUTF8String:"Init'd with utf8" ] ;
これに関する私の問題はメモリです。 UITextFieldのtextプロパティの古い値はどうなりますか。
あなたがする必要はありません:
// 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 ] ;
通常のCと同じように、メモリ管理についてまだ考えています。これがここの欠陥である可能性があります。