0

私のタブバーアプリケーションのfirsタブにテーブルビューがあります。その後、任意の行をクリックすると、secondviewControllerのビューをプッシュします。ラベルがあります。ラベルのテキストは、行のテキストで選択する必要があります。私はこれを試して、2番目のタブを入力しないでください:Sどうすればいいですか?また、secondViewControllerクラスには3つのビューがあります。テーブルビュー選択されたインデックスメソッドが機能しません(プッシュ)

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 

SecondViewController *detailViewController = [[SecondViewController alloc] initWithNibName:@"SecondView" bundle:nil]; 
// ... 
// Pass the selected object to the new view controller. 
NSUInteger row2 = [indexPath row]; 
denemelik=row2; 

[self.navigationController pushViewController:detailViewController animated:YES]; 
detailViewController.enyakinfirma.text= [ws2.CustomerName objectAtIndex:[indexPath row]]; 
NSLog(@"kontrol2 %@",ws2.CustomerName); 

[detailViewController release]; 

}

答えて

0

私はenyakinfirmaはあなたがテキストを取り込むにしたいあなたのUILabelであることを前提としています。ラベルが実際に作成されて読み込まれる前に、ラベルにテキストを割り当てることはできません。そして、新しいView Controllerをプッシュした後で、それが後で起こります。

このように、あなたが必要とするこのテキストのトラックに保つために、別々の@propertyを作成する必要があります:あなたは、このプロパティを割り当てるビューコントローラを作成すると

// SecondViewController.h 
@interface SecondViewController { 
    NSString *customerName; 
}  
@property (nonatomic, retain) NSString *customerName; 
@end 

を:

detailViewController.customerName = ...; 

とでビューコントローラのviewDidLoadメソッドを使用してテキストを更新します。

-(void)viewDidLoad { 
    // ... 
    enyakinfirma.text = self.customerName; 
} 
+0

私は –

+0

はそうsecondViewControllerクラスがsecondViewを押していない別の2のビューを持っているということです:(これを試してみましたが、まだ動作しません:( –

+0

あなたは私を助けてchould私は道を解決したことができません:?。S:S –

関連する問題