我需要将所选表格视图行的 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];
}
但没有得到价值