【问题标题】:How to save a data in to array without DB如何在没有数据库的情况下将数据保存到数组中
【发布时间】:2012-08-17 04:02:42
【问题描述】:

如何将新添加的值保存到 NSMuttable 数组中,我想通过单击按钮重置新添加的项数组?谁能帮助我?

【问题讨论】:

    标签: iphone ios uitableview uibutton


    【解决方案1】:

    通过以下方式添加它

    array = [nsmutablearray arraywithcontentsoffile:path];
    nsstring *item= @"string";
            [array addObject:item];
            [array writeToFile:path atomically:YES];
    

    用不同的方法删除它:

            [array removeObjectAtIndex:1];
    

    [[NSFileManager defaultManager]removeItemAtPath:Path error:nil];
    

    【讨论】:

      猜你喜欢
      • 2012-12-16
      • 2019-04-25
      • 2019-09-08
      • 2011-08-31
      • 1970-01-01
      • 1970-01-01
      • 2018-06-20
      • 1970-01-01
      • 2018-08-06
      相关资源
      最近更新 更多