ストーリーボードを使用して iPad のプロジェクトに取り組んでいます。UITableView に plist のデータを入力しようとしています。Plist には NSDictionary があり、これには 9 つの配列があり、それぞれに 3 つの要素 (1 つの数値と 2 つの文字列) があります。各配列 (文字列) から 2 番目の要素 [1] を取得し、それらの文字列をテーブルに入力します。
ヘッダファイルから;
@interface EonOrderOfPrinciple : UIViewController
<UITableViewDataSource, UITableViewDelegate>
@property (strong, nonatomic) IBOutlet UITableView *formManeuvers;
@property (nonatomic, strong) NSDictionary *Wild;
@property (nonatomic, strong) NSArray *Smash;
@property (nonatomic, strong) NSArray *CloseCombat;
@property (nonatomic, strong) NSArray *HeadButt;
@property (nonatomic, strong) NSArray *Pummel;
@property (nonatomic, strong) NSArray *Obstacle;
@property (nonatomic, strong) NSArray *Confusion;
@property (nonatomic, strong) NSArray *ImpWeap;
@property (nonatomic, strong) NSArray *Rage;
@property (nonatomic, strong) NSArray *WildStorm;
実装から;
NSString *aFile = [[NSBundle mainBundle]
pathForResource:@"Wild" ofType:@"plist"];
Wild = [[NSDictionary alloc] initWithContentsOfFile:aFile];
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
cell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:@"cell"];
NSString *currentManeuverName;
currentManeuverName = [Smash objectAtIndex:1];
[[cell textLabel] setText:currentManeuverName];
return cell;
}
@end
今は1つのセルしか与えていないことに気づきました。1 つが動作するようになったら、残りのデータを入力できるようになると考えました。今はそれさえも手に入れることができません。
このようにネストされたデータを使用する方法を説明しているチュートリアルも、私が見つけたヘルプもありません。見つけたもののさまざまなバージョンを使用しようとしましたが、何も機能しません。Core Data に移る前に、plist の使い方を学びたかったのです。私が作った非常に単純な plists は正常に機能します。このネストされたビジネスが私をつまずかせているようです。
* 10 月 29 日更新 ... plist を削除しました *
それで。ネストされたディクショナリ plist を使用して、情報に正しくアクセスし、テーブルにデータを入力する方法を教えてください。繰り返しますが、これはネストされた辞書を使用しています。これは私がどうすればよいか分からないことであり、これは私がどのようにすればよいかを学ぼうとしていることです。