-4
我有一个乐队应用程序,其中应用程序需要有乐器音阶。要做到这一点,我正在尝试使用比例名称和描述来创建一个PList文件。我已经研究过了,我所能找到的只是传递图像,而不是URL。我已经完成了plist。这是它的一部分:URL从Plist到详细信息视图控制器的Web视图
而且我也有一个表视图获取Plist文件的名称和缩放部分。
我无法弄清楚如何做的是,我怎么深入到详细信息视图控制器,然后加载的点击表格视图单元格成UI网页视图的URL,这里是从主表视图的.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
` 如果任何人有任何想法如何做到这一点,请帮助我吗?
这是否工作在故事板应用程序。由于网络链接部分不起作用 – Steve
我明白,我的问题是它现在说,Indexpath是一个未声明的标识符。有谁知道如何解决这个问题? – Steve
它在那里,我只是不知道如何转移的URL。下面是它的一个副本:' - (void)prepareForSegue :(UIStoryboardSegue *)segue sender:(id)sender { //确保您的故事板中的segue名称与此行相同 if([[ segue identifier] isEqualToString:@“Detail”]) { //获得对目标视图控制器的引用 } – Steve