今日、私はこの質問から生まれた質問があります: Database Results in Cocoa . データベースから返されたデータを使用して、特定の数の質問を作成することに関するものです。次のコードの形式を使用しています (これは質問に投稿されています)。
NSMutableDictionary * interfaceElements = [[NSMutableDictionary alloc] init];
for (NSInteger i = 0; i < numberOfTextFields; ++i) {
//this is just to make a frame that's indented 10px
//and has 10px between it and the previous NSTextField (or window edge)
NSRect frame = NSMakeRect(10, (i*22 + (i+1)*10), 100, 22);
NSTextField * newField = [[NSTextField alloc] initWithFrame:frame];
//configure newField appropriately
[[myWindow contentView] addSubview:newField];
[interfaceElements setObject:newField forKey:@"someUniqueIdentifier"];
[newField release];
}
ただし、IFVerticallyExpandingTextfield ( http://www.cocoadev.com/index.pl?IFVerticallyExpandingTextFieldから) を使用しようとしたり、大量のテキストを作成しようとすると、他の描画されたコンテンツを単に超えてしまいます。オブジェクトで setAutosizingMask: を使用することを検討しましたが、これまでのところ機能していません。
助けてくれてありがとう。
編集:効果をどのように見せたいかは「正しいテキストフィールド」と呼ばれ、何が起こるかは「スタックオーバーフローサンプル」と呼ばれます- http://www.mediafire.com/?sharekey=bd476ea483deded875a4fc82078ae6c8e04e75f6e8ebb871 .
EDIT 2:そして、このIFVerticallyExpandingTextfieldクラスの使用方法を誰も知らない場合、効果を達成する別の方法があるかどうかは誰にもわかりますか?