2 garaster garaster 于 2013.06.19 14:13 提问

在转移视图控制器后隐藏cell

在用segue改变文本后,使用segue隐藏一个单元。没实现。

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{

TerminalsViewController *transferViewController = segue.destinationViewController;

NSLog(@"prepareForSegue: %@", segue.identifier);
if([segue.identifier isEqualToString:@"firstSegue"])
{
    transferViewController.term1Text = @"Joe Smith";
    transferViewController.term2Text = @"555-555-5556";
    transferViewController.term3Text = @"06/27/1984";

}else if([segue.identifier isEqualToString:@"thirdSegue"]){
    transferViewController.term1Text = @"John Smith";
    transferViewController.term2Text = @"555-555-5556";
    transferViewController.term3Text = @"06/27/1972";
    transferViewController.cell1.hidden = YES;

}

}

好心人帮忙看一下,谢谢

1个回答

Mr_me
Mr_me   2013.06.19 15:50
已采纳

prepareForSegue:

TerminalsViewController *transferViewController = segue.destinationViewController;

NSLog(@"prepareForSegue: %@", segue.identifier);
if([segue.identifier isEqualToString:@"firstSegue"])
{
    transferViewController.term1Text = @"Joe Smith";
    transferViewController.term2Text = @"555-555-5556";
    transferViewController.term3Text = @"06/27/1984";

}else if([segue.identifier isEqualToString:@"thirdSegue"]){
    transferViewController.term1Text = @"John Smith";
    transferViewController.term2Text = @"555-555-5556";
    transferViewController.term3Text = @"06/27/1972";
    transferViewController.hideCell = YES;

}

TransferViewController.h:

@property (nonatomic) boolean hideCell;

TransferViewController.m:

@synthesize hideCell;

TransferViewController.m:cellForRowAtIndexPath:

if (hideCell) {
    cell1.hidden = YES;
}
Csdn user default icon
上传中...
上传图片
插入图片