2

当用户查看包含视频的帖子的详细信息时,我想在帖子缩略图上显示一个“播放”图标。

我试过这个,但它没有编译:

    if ([postType isEqualToString:@"video"]) {
        UIImageView *videoIcon = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vicon"]];
        videoIcon.frame = CGRectMake(5, 10, 35, 35);
        [self addSubview:videoIcon]; 
    }

给出的错误是:

No visible @interface declares the selector addSubview

有谁知道如何使这项工作?

上面的代码在我的 DetailViewController.m 中。整体结构是具有 Master/Detail 接口的 UICollectionView 的结构。

4

1 回答 1

8

也许

[self.view addSubview:videoIcon];

if selfis not a subclass of UIViewthenaddSubview不太可能被定义

于 2012-12-01T21:50:13.983 回答