2011-08-11 12 views
0

私は、DetailViewControllerとして動作しているUITableViewControllerで表示するためにデータを取得しようとしているplistを持っています。私はUIPickerViewのplistからデータを表示する方法を知っています。それは同じですか、あるいは何を変えなければなりませんか?情報からplist in UITableViewController

私は何を持っている:

- (void)viewDidLoad 
{ 

    [super viewDidLoad]; 

    NSBundle*bundle=[NSBundle mainBundle]; 
    NSString *path = [bundle pathForResource:@"Grammar" ofType:@"plist"]; 
    grammarArray = [[NSArray alloc] initWithContentsOfFile:path]; 

    [self configureView]; 
} 


- (void)tableView:(UITableView *)tableViewdidSelectRow:(NSInteger)rowinComponent:(NSInteger)component 
{ 

} 

はどこ私はここから行くのですか?

答えて

0

それは前方にかなりストレートです:

UITableViewCellにデータを表示することができるようにするには、UITableViewController

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPathデリゲートメソッドを使用して行われます。

このメソッドの内部では、現在のさまざまなメンバを設定できますUITableViewCell

textLabelまたはdetailTextLabelなどです。

You can further extend a UITableViewCell and add more features to it.

+0

私がしなければならないのは、私のPLISTからデータを取り出すことです。それから私はどうしたら - "(NSInteger)コンポーネント :(UIPickerView *)pickerView didSelectRow::(NSInteger)行inComponent(NSStringの*)pickerView " :私はUIPickerViewを使用していた場合、私のような何かをしたいです私のPLDのNSDictionaryとNSStringsを使用して、私のラベルのUIPickerViewから選択したものを使用することができました。どのように私はUITableViewsと同様の何かを行うのですか? – lakerka

+0

のUITableViewControllerで 'cellForRowAtIndexPath'と呼ばれる同様のメソッドを使用してセルを初期化します –

+0

「行」が定義されていないと「行」を使用してエラーが発生します。 私は何を使用しますか?完全なコードは のようになります。 - (void)viewDidLoad { NSBundle * bundle = [NSBundle mainBundle]; NSString * path = [bundle pathForResource:@ "文法" ofType:@ "plist"]; grammarArray = [[NSArray alloc] initWithContentsOfFile:path]; [自己configureView] } - (のUITableViewCell *)のtableView:(のUITableView *)のtableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {NSDictionaryの* grammarInfo = [grammarArray cellForRowAtIndexPath:行]。 } ' – lakerka

関連する問題