将UIPicker数据存储在NSDictionary中

时间:2014-07-24 00:21:45

标签: ios xcode nsdictionary uipicker

我在Master-Detail视图中有一个包含'类别'的UIPicker。我想设置'类别'到该项目的NSDictionary。 NSDictionary包含标题为'标题的项目。 '量'和'类别'。

如何将UIPicker数据提供给NSDictionary?

- (IBAction)categoryTextChanged:(UITextField *)sender {
    [self.category setObject:sender.text forKey:@"category"];
- (void)configureView
{
    // Update the user interface for the detail item.
    if (self.item)
        self.itemText.text = [self.item objectForKey:@"item"];
    if (self.quantity)
        self.quantityText.text = [self.quantity objectForKey:@"quantity"];
    if (self.category){
        self.categoryText.text = [self.category objectForKey:@"category"];
        //self.categoryTextLabel.text = [self.category objectForKey:@"category"];
    }

}
- (void)setCategory:(id)newCategory
{
    if (_category != newCategory) {
        _category = newCategory;
        // Update the view.
        [self configureView];
    }
}

0 个答案:

没有答案