0
我是一個Objective-C的新手,並在特定的point.I必須傳遞一個UILabel值從tableviewcell滾動視圖中的標籤時,accessoryButtonTappedForRowWithIndexPath行爲發生。但值不通過..我donno在哪裏Iam出錯了?我寫這段代碼:將UItableviewcell的UILabel值傳遞給iPhone中的另一個視圖返回空值?
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];
}
我可以看到標籤而不是價值它... Y就那麼如何一個UILabel值傳遞給另一種觀點?