ios – Exterior Show View Bounds to Match TV Decision

0
12


I’ve my app set to have the ability to mirror to an AppleTV, and regardless of the constraints I’ve, about half of the underside a part of the PDF being displayed within the WKWebView is stretching previous the underside of the TV. The code I take advantage of and the warning dialog I get are under. The TV is 4K, as is the Apple TV, and I merely want it so that every web page of the PDF within the WKWebView takes up the display screen, even when some scaling is required.

 self.secondWindow = [[UIWindow alloc] init];
  self.secondWindow.display screen = display screen;
  self.secondWindow.display screen.overscanCompensation = UIScreenOverscanCompensationScale;

  UIViewController *viewController = [[UIViewController alloc] init];
    self.secondWindow.rootViewController = viewController;
    viewController.view.body=CGRectMake(0, 0, 1920, 1080);
    [self.secondWindow makeKeyAndVisible];
    WKWebView *theSongView = [[WKWebView alloc] init];
    [theSongView setTranslatesAutoresizingMaskIntoConstraints:NO];
    [viewController.view addSubview:theSongView];
    theSongView.body = CGRectMake(0, 0, 1920, 1080);
    
    UILayoutGuide *safeG = [viewController.view safeAreaLayoutGuide];

    [NSLayoutConstraint activateConstraints:@[
        [theSongView.topAnchor constraintEqualToAnchor:safeG.topAnchor],
        [theSongView.leadingAnchor constraintEqualToAnchor:safeG.leadingAnchor],
        [theSongView.trailingAnchor constraintEqualToAnchor:safeG.trailingAnchor],
        [theSongView.bottomAnchor constraintEqualToAnchor:safeG.bottomAnchor],
    ]];
   
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
       NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *pdfPath = [[documentsDirectory stringByAppendingPathComponent:selectedCountry] stringByAppendingString:@".pdf"];
        NSURL *url = [NSURL fileURLWithPath:pdfPath];
        NSLog(@"%@",url);
        NSURLRequest *request = [NSURLRequest requestWithURL:url];
        [theSongView loadRequest:request];
       
        timer = [NSTimer scheduledTimerWithTimeInterval:(1.0/2.0) target:self selector:@selector(tick) userInfo:nil repeats:YES];
        
   
}

Making an attempt to transform rect: {{0, 0}, {3840, 2160}} from <UIScreen: 0x104f45550; bounds = {{0, 0}, {3840, 2160}}; mode = <UIScreenMode: 0x2814a7300; measurement = 3840.000000 x 2160.000000>> (oriented) to <UIScreen: 0x104f06590; bounds = {{0, 0}, {834, 1194}}; mode = <UIScreenMode: 0x281482040; measurement = 1668.000000 x 2388.000000>> (oriented), which isn't a sound conversion; returning CGRectNull.

LEAVE A REPLY

Please enter your comment!
Please enter your name here