テキストコンテンツを読むためのアプリケーションを開発しています。そのリーダーには、iBooks のような付箋機能が必要です。それらのメモをデバイス内に保存したい。入力したテキストの内容を保存するには?入力したテキストを再度開く方法 (つまり、入力したテキストをどこに/どのように保存するか)
UIMenuItem *item = [[[UIMenuItem alloc] initWithTitle: @"Wikipedia" action: @selector(wiki:)] autorelease];
UIMenuItem *item1 = [[[UIMenuItem alloc] initWithTitle: @"Dictionary" action: @selector(dict:)] autorelease];
UIMenuItem *item2 = [[[UIMenuItem alloc] initWithTitle: @"Highlight" action: @selector(highlighting:)] autorelease];
UIMenuItem *item3 = [[[UIMenuItem alloc] initWithTitle: @"Notes" action: @selector(noteMaking:)] autorelease];
[menuController setTargetRect:CGRectMake(100, 100, 320, 100) inView:self.view];
[menuController setMenuVisible:YES animated:YES];
[menuController setMenuItems: [NSArray arrayWithObjects: item,item1,item2,item3,nil]];
-(void) noteMaking:(id) sender
{
notes = [[UITextView alloc] initWithFrame:CGRectMake(100, 100, 620, 520)];
notes.text = @"";
notes.scrollEnabled = YES;
[self.view addSubview:notes];
}
CoreData は、データ管理に最適で最も信頼性の高いフレームワークです。特に非常に大量のデータの場合。あなたの目的に反して、ブック、ページ、メモのテーブルを含むデータベースを作成することをお勧めします。CoreData はそこからエンティティ クラスを作成し、後でデータを簡単に永続化できます。
.plit ファイルはドキュメント ディレクトリ内に保存でき、いつでも取得および保存できます。読み取ると解析され、トラバースしやすい NSDictionary オブジェクトが得られます。ただし、大量のデータを処理することになり、CRD 操作のコストが非常に高くなるため、これは優れたオプションではありません。