开发者

iPhone change background if allowsAirPlay is true

开发者 https://www.devze.com 2023-03-10 17:22 出处:网络
What I am trying to achieve is an if statement which finds out if AirPlay is enabled or not. I know that the property is allowsAirPlay and that it comes from MPVolumeView. But I am stuck from here on

What I am trying to achieve is an if statement which finds out if AirPlay is enabled or not.

I know that the property is allowsAirPlay and that it comes from MPVolumeView. But I am stuck from here on in. Any help is much appreciated!

if (allowsAirPlay){
    UIImageView *streamBG = [[UIImageView alloc]
                             initWithImage:[UIImage imageNamed:@"img1.jpg"]];

    [self.view addSubview:streamBG];
    [self.view sendSubviewToBack:streamBG];

    streamBG.frame = CGRectMake(0, 0, 320, 480);

    [streamBG release];
} else {

    UIImageView *emailBG_AP = [[UIImageView alloc]
                           initWithImage:[UIImage imageNamed:@"background_schedule.jpg"]];

   [self.view addSubview:emailBG_AP];
   [self.view sendSubviewToBack:emailBG_AP];

   ema开发者_如何转开发ilBG_AP.frame = CGRectMake(0, 0, 320, 480);

   [emailBG_AP release];}
}


allowsAirPlay is a property in MPMoviePlayerController which you can flip YES and NO. The value won't tell you whether there are AirPlay enabled devices in range. I don't think there are public APIs that tell give you that information.

0

精彩评论

暂无评论...
验证码 换一张
取 消