我有带有文本字段和 2 个按钮的警报窗口,我需要将在我的文本字段中添加的文本保存到 .plist 文件,我该怎么做?
.h 文件
NSMutableDictionary *cameras;
我的警报代码
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if(buttonIndex == [alertView firstOtherButtonIndex])
{
NSString *plistPath = [DOCUMENTS stringByAppendingPathComponent:@"Cameras.plist"];
NSData *plistData = [NSPropertyListSerialization dataFromPropertyList:cameras format:NSPropertyListXMLFormat_v1_0 errorDescription:nil];
if(plistData)
[plistData writeToFile:plistPath atomically:YES];
}
}