0

我从 Web获取JSON MutableArray包含 YouTube URL 字符串..

目的是在每个单元格中执行UIWebView

我的代码:如何实现代码?谢谢。

@property (nonatomic, strong) NSMutableArray* arrMovies;
@synthesize arrMovies;


    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyIdentifier"];

        if (cell == nil) {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"MyIdentifier"];

            cell.selectionStyle = UITableViewCellSelectionStyleBlue;
        }



        cell.textLabel.text = [[self.arrMovies objectAtIndex:indexPath.row] valueForKey:@"title"];

        cell.detailTextLabel.text = [NSString stringWithFormat:@"%@ views | Duration: %i",

      [[self.arrMovies objectAtIndex:indexPath.row] valueForKey:@"viewCount"],intMinutes];





        return cell;
    }
4

1 回答 1

1

我认为您误解了 UIWebView 是什么。UIWebView 允许您在应用程序中嵌入 Web 内容。这与发出 Web 请求、获取 JSONString、解析它并在视图中显示它不同。我认为这就是您真正要问的问题。请编辑您的问题/确认这一点。

您上面的代码具体有什么问题?您面临哪些问题?我认为你的问题是你需要一个@property (nonatomic, strong) NSMutableArray* arrMovies;and@synthesize artMoves = _artMovies;在你的实现文件中。

确保也覆盖你的 artMovies 属性的 getter。

于 2013-01-17T17:32:27.657 回答