選択したテーブルビュー行の UiLabel 値を他のビューのラベルに渡す必要があります。どうすればよいですか? 私はこれを試しました:
ViewController1.h:
UILabel *name1;
@property(nonatomic,retain)IBOutlet UILabel *name1;
ViewController1.m:
- (void) tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
ViewController2 *v2 = [[ViewController2 alloc] initWithNibName:@"ViewController2" bundle:nil];
v2.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:v2 animated:YES];
v2.provName=[name1 retain]; //name1 is the name of UILabel in TableView.
[v2 release];
}
ViewController2.h
UILabel *providerName;
SString *provName;
ViewController2.m:
- (void)viewDidLoad
{
providerName =[[UILabel alloc] init];
[providerName setFrame:CGRectMake(10,10,300,50) ];
providerName.textAlignment=UITextAlignmentLeft;
providerName.backgroundColor=[UIColor blackColor];
self.providerName.text=self.provName;
providerName.highlightedTextColor=[UIColor whiteColor];
[self.view addSubview:providerName];
}
しかし、値を取得していません