0
ビューコントローラのサブビューとして(iPhoneのような)メモを作成したいのですが、ユーザーが画面に表示する必要があるボタンをタップするときです。 これを行う方法は? ありがとうございます。iphoneとipadのメモを作成する
ビューコントローラのサブビューとして(iPhoneのような)メモを作成したいのですが、ユーザーが画面に表示する必要があるボタンをタップするときです。 これを行う方法は? ありがとうございます。iphoneとipadのメモを作成する
nsobjects
をplistに保存する方法です。
NSString *path = [[NSBundle mainBundle] pathForResource:@"DetailsList" ofType:@"plist"];
NSMutableArray *array = [NSMutableArray arrayWithContentsOfURL:[NSURL URLWithString:path]];
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:textView.text, @"Note", [NSDate date], @"Current Date", nil];
[array addObject:dict];
NSString *error;
NSData *plistData = [NSPropertyListSerialization dataFromPropertyList:array
format:NSPropertyListXMLFormat_v1_0
errorDescription:&error];
if(plistData)
{
if([plistData writeToFile:path atomically:YES])
NSLog(@"success");
else
NSLog(@"fail");
}
else
{
NSLog(@"%@ ", error);
[error release];
}
詳細については、ここで参照してくださいhttp://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSPropertyListSerialization_Class/Reference/Reference.html
@robin私は、ユーザーがメモを書くことができるテキストビューを作成しようとしましたが、私はアプリケーション内で保存する方法を知りませんでした、そして、ユーザーは彼が望むこのメモwholdを見ている必要があります。 –
オハイ、どうですか?ありがとう –