0

テキスト (メモ) を表示するために、tableViewController から UILabel を使用して viewController へのセグエがありますが、テキストが表示されません。

例えば:

- (void)viewDidLoad
{
[super viewDidLoad];


list = [[NSMutableArray alloc] init];

 wine *barbera =[[wine alloc] init];
[barbera setName:@"Barbera"];
[barbera setNotes:@"stuff about this..."];
[list addObject:barbera];

wine *chardonnay=[[wine alloc]init];
[chardonnay setName:@"Chardonnay"];
[chardonnay setNotes:@"stuff about this..."];
[list addObject:chardonnay];

wine *cheninBlanc =[[wine alloc]init];
[cheninBlanc setName:@"Chenin Blanc"];
[cheninBlanc setNotes:@"stuff about this... "];
[list addObject:cheninBlanc];

私のセグエ:

-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
DescriptionWineViewController * dwvc= [segue destinationViewController];
[dwvc setCurrentWine :[self currentWine]];
}

私も試みました:

-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
DescriptionWineViewController * dwvc= [segue destinationViewController];
[dwvc setNotes :[self notes]];
}

そして、それがセグエされるviewController:

@interface DescriptionWineViewController ()

@end

@implementation DescriptionWineViewController

@synthesize descriptionLabel;
@synthesize currentWine;
@synthesize notes;


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
    // Custom initialization
}
return self;
}

- (void)viewDidLoad

{
[super viewDidLoad];

[descriptionLabel setText: [currentWine notes]];

 }

さらに情報が必要な場合はお知らせください。

4

1 に答える 1

0

問題はおそらく にありcurrentWineます。選択したアイテムに設定するには、これを実装する必要がありtableView:didSelectRowAtIndexPath:ます。

于 2013-05-05T15:29:41.657 に答える