【问题标题】:Xcode Core Data AttributesXcode 核心数据属性
【发布时间】:2012-08-01 19:57:48
【问题描述】:

我正在制作一个应用程序,并且有一个包含一个实体和 15 个布尔属性的核心数据文件。我想要它,以便当用户按下按钮时,它会将核心数据文件中属性之一的值从“0”更改为“1”。执行此操作的代码是什么?我已经设置了动作。

【问题讨论】:

    标签: ios xcode core-data attributes boolean


    【解决方案1】:
    -(void)buttonAction:(id)sender {
       myManagedObject.boolAttribute = [NSNumber numberWithBool:
        ![myManagedObject.boolAttribute boolValue]];
       [self.managedObjectContext save:nil];
       // if you need to update the UI (no fetchedResultsController):
       [self.view setNeedsDisplay]; 
       // or
       [self.tableView reloadData];
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-06-30
      • 2012-03-02
      • 2015-04-24
      • 1970-01-01
      • 2011-07-16
      • 2016-05-07
      • 2011-06-17
      相关资源
      最近更新 更多