Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何根据子视图ios返回的值更改字幕单元格的值_Ios_Objective C_Uitableview - Fatal编程技术网

如何根据子视图ios返回的值更改字幕单元格的值

如何根据子视图ios返回的值更改字幕单元格的值,ios,objective-c,uitableview,Ios,Objective C,Uitableview,我所要做的就是根据子视图中指定的值更改特定UITableViewCell中标签的值。 我有一个显示产品名称和可用尺寸的uitableviewcell。单击应用程序中的product单元格后,我将显示包含textfield的子视图。我使用委托从子视图传递数据,如下面的代码所示。当我返回到父视图时,一切正常,返回textfield的值,但我不知道在返回到父视图后如何更改特定单元格中标签的值。 父视图.m -(void)addSizeToParentView:(SizeViewController*)

我所要做的就是根据子视图中指定的值更改特定UITableViewCell中标签的值。 我有一个显示产品名称和可用尺寸的uitableviewcell。单击应用程序中的product单元格后,我将显示包含textfield的子视图。我使用委托从子视图传递数据,如下面的代码所示。当我返回到父视图时,一切正常,返回textfield的值,但我不知道在返回到父视图后如何更改特定单元格中标签的值。 父视图.m

-(void)addSizeToParentView:(SizeViewController*)controller didFinishEnteringSizeInfo:(NSString*)sizeInfo{
NSLog(@"This was returned from sizeViewController: %@",sizeInfo);}    


-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *simpleTableIdentifier = @"PackageCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
    if (cell==nil) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:simpleTableIdentifier];

        UILabel *productNameLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 0, 300, 29)];
        productNameLabel.text = [self.choosedProducts objectAtIndex: indexPath.row];
        [cell.contentView addSubview:productNameLabel];

    UILabel *sizeListLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 25, 300, 15)];
        sizeListLabel.text = @"THIS LABEL SHOULD BE POPULATE BY VALUE OF CHILD VIEW!!"
        UIFont *font = [UIFont fontWithName:@"Arial" size:15];
        sizeListLabel.font = font;
        sizeListLabel.textColor = [UIColor grayColor];
        [cell.contentView addSubview:sizeListLabel];
    }
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

                [tableView deselectRowAtIndexPath:indexPath animated:YES];
                UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:[NSBundle mainBundle]];
                SizeViewController *sizeViewController = [storyboard instantiateViewControllerWithIdentifier:@"SizeView"];
                sizeViewController.title = [self.choosedProducts objectAtIndex:indexPath.row];

                sizeViewController.delegate = self;

                [[self navigationController] pushViewController:sizeViewController animated:YES];
}

SizeViewController.m

- (void)viewDidLoad
{
    [super viewDidLoad];
    setSizes = [[NSMutableDictionary alloc]init];
    self.tableView.scrollEnabled = NO;
    self.manager = [[RETableViewManager alloc] initWithTableView:self.tableView];
    self.manager.style.cellHeight = 60;

// Add a section
//
RETableViewSection *section = [RETableViewSection section];
section.headerTitle = @"Specify sizes & quantities";
[self.manager addSection:section];

self.sizes = [RELongTextItem itemWithValue:nil placeholder:@"ex. XL:5, L:10, M:15, S:5, XS:12"];
self.sizes.validators = @[@"presence"];
self.sizes.cellHeight = 200;
    [section addItem:self.sizes];
    self.sizes.onEndEditing = ^(RELongTextItem *size){
        NSLog(@"Value: %@", size.value);
        [self.delegate addSizeToParentView:self didFinishEnteringSizeInfo:size.value];

    };

}
在ParentView中尝试。m:

-(void)viewWillAppear:(BOOL)animated {

  [self.tableView reloadData];
}
如何填充sizeListLabel?这是一个国家安全局吗?
要编辑要从sizeViewController返回的单元格,您应该在数组的那个索引处替换对象。

好的,但是如何更改特定单元格上的值,例如,在单击indexPath上的product之后。行=1我只想更改这个indexPath上标签的值。行??Ilario我将尝试这样做。我交换了表中的对象,但没有帮助。大小标签值未更改。除了使用VIEWWILLEXPEND的方法,还有其他方法吗??当做