我在UIActionSheet
按钮中的问题添加到下一个视图中的收藏点击和复制UITableViewCell
,因此我在商店动态创建plist文件中使用字符串值,并首次单击单元格并打开UIActionSheet
和添加到收藏夹UIButton
正确点击并复制1个单元格,但第二次添加到收藏夹点击而不添加2个项目存储只有1个新数组项目所以我的问题在plist文件中一次1值添加所以任何答案.. `
存储来自plist的数据
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex ==2) {
FavoritesViewController *objfav= [self.storyboard instantiateViewControllerWithIdentifier:@"fav"];
NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsPath = [paths objectAtIndex:0];
NSString *plistPath = [documentsPath stringByAppendingPathComponent:@"manuallyData.plist"];
[arrplist addObject:quote];
NSDictionary *plistDict = [[NSDictionary alloc] initWithObjects: [NSArray arrayWithObjects: arrplist, nil] forKeys: [NSArray arrayWithObjects: @"icon", nil]];
NSString *error = nil;
NSData *plistData = [NSPropertyListSerialization dataFromPropertyList:plistDict format:NSPropertyListXMLFormat_v1_0 errorDescription:&error];
if(plistData)
{
[plistData writeToFile:plistPath atomically:YES];
}
else
{
}
objfav.arrCopy = arrplist;
[self.navigationController pushViewController:objfav animated:YES];
}
}
fetch data from dynamic create plist file in nextview
NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsPath = [paths objectAtIndex:0];
NSString *plistPath = [documentsPath stringByAppendingPathComponent:@"manuallyData.plist"];
if (![[NSFileManager defaultManager] fileExistsAtPath:plistPath])
{
plistPath = [[NSBundle mainBundle] pathForResource:@"manuallyData" ofType:@"plist"];
}
NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:plistPath];
arrCopy = [dict objectForKey:@"icon"];