アプリに楽器のスケールが必要なバンドアプリケーションがあります。これを行うために、スケールの名前と説明を含む PList ファイルを作成しようとしています。私が調査したところ、URLではなく画像を渡すことだけが見つかりました。plistができました。その一部を次に示します。
また、Plist ファイルの名前とスケール部分を取得するテーブル ビューもあります。
どうすればよいかわかりません。詳細ビュー コントローラーにドリルダウンして、クリックしたテーブル ビュー セルの URL を UI Web ビューにロードする方法は次のとおりです。メイン テーブルの .m からのコードは次のとおりです。見る:
#import "TableViewController.h"
#import "DetailView.h"
@interface TableViewController ()
@end
@implementation TableViewController
@synthesize content = _content;
-(NSArray *)content
{
if (!_content) {
_content = [[NSArray alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Scales" ofType:@"plist"]];
}
return _content;
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Make sure your segue name in storyboard is the same as this line
if ([[segue identifier] isEqualToString:@"Detail"])
{
// Get reference to the destination view controller
}
}
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return [self.content count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
cell.textLabel.text = [[self.content objectAtIndex:indexPath.row] valueForKey:@"Name"];
cell.detailTextLabel.text = [[self.content objectAtIndex:indexPath.row] valueForKey:@"Scale"];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Navigation logic may go here. Create and push another view controller.
/*
<#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil];
// ...
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
*/
}
@end
これを行う方法を知っている人がいたら、助けてください。