1

我在背景上显示媒体播放器时遇到问题。

我正在使用这段代码:

NSMutableArray *layout = [ LayoutEpisodes layoutEpisodes];   
NSMutableArray *videoSplat = [ VideoUrls videoEpisodes];

NSLog(@" %@", videoSplat);

NSArray* nibView1 = [[NSBundle mainBundle] loadNibNamed:@"SeasonPreview" owner:self options:nil]; 
NSArray* nibView2 = [[NSBundle mainBundle] loadNibNamed:@"SeasonPreview" owner:self options:nil];
NSArray* nibView3 = [[NSBundle mainBundle] loadNibNamed:@"SeasonPreview" owner:self options:nil];
NSArray* nibView4 = [[NSBundle mainBundle] loadNibNamed:@"SeasonPreview" owner:self options:nil];

NSArray* nibVideoView = [[NSBundle mainBundle] loadNibNamed:@"SeasonPreview" owner:self options:nil];
[[VideoPreview alloc]init];
[[SeasonsPreview alloc]init];


SeasonsPreview *firstView =  [nibView1  objectAtIndex:0];
SeasonsPreview *secondView = [nibView2  objectAtIndex:0];
SeasonsPreview *thirdView =  [nibView3  objectAtIndex:0];
SeasonsPreview *fourthView = [nibView4  objectAtIndex:0];

SeasonsPreview *splatterVideo = [nibVideoView objectAtIndex:0];

int i=0, j=0;
for(i=0;i<([layout count]);i++,j++)
{

    NSString *titleViewImage = [layout objectAtIndex:i];
    i++;
    NSString *logoViewImage =[layout objectAtIndex:i];
    i++;
    NSString *backgroundViewImage =[layout objectAtIndex:i];

    NSURL *urlTitle = [NSURL URLWithString:titleViewImage];  
    UIImage *titleImage = [UIImage imageWithData:[NSData dataWithContentsOfURL:urlTitle]]; 

    NSURL *urlLogo = [NSURL URLWithString:logoViewImage];  
    UIImage *logoImage = [UIImage imageWithData:[NSData dataWithContentsOfURL:urlLogo]]; 

    UIColor *backgroundUIcolor =[UIColor colorWithHexString:backgroundViewImage];


    if(i>=0 && i<=3){
    firstView.titleView.image = titleImage;
    firstView.logoView.image = logoImage;
    firstView.backgroundView.backgroundColor = backgroundUIcolor;
    firstView.center = CGPointMake(385,150);}

(注意:这不是所有代码,因为它太长了。)

引用FirstView是我为创建视图的新实例而调用的对象。这个对象允许我显示背景、标题和一张小图片。

我必须添加媒体播放器:我可以使用与 FirstView 相同的过程吗?

4

0 回答 0