私は、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
{
}
はどこ私はここから行くのですか?
私がしなければならないのは、私のPLISTからデータを取り出すことです。それから私はどうしたら - "(NSInteger)コンポーネント :(UIPickerView *)pickerView didSelectRow::(NSInteger)行inComponent(NSStringの*)pickerView " :私はUIPickerViewを使用していた場合、私のような何かをしたいです私のPLDのNSDictionaryとNSStringsを使用して、私のラベルのUIPickerViewから選択したものを使用することができました。どのように私はUITableViewsと同様の何かを行うのですか? – lakerka
のUITableViewControllerで 'cellForRowAtIndexPath'と呼ばれる同様のメソッドを使用してセルを初期化します –
「行」が定義されていないと「行」を使用してエラーが発生します。 私は何を使用しますか?完全なコードは のようになります。 - (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