looking for some solutions? You are welcome.

SOLVED: how to fix SafeAreaLayoutGuide

Game Keeper:

I am making a game with canvas. Game is clipped because of the top notch, I tried SafeAreaLayoutGuide, but nothing happened. Please look at the code below and let me know what Iam doing wrong.

(void) createGLView {
//create our openglview and size it correctly
OpenGLView *glView = [[OpenGLView alloc] initWithFrame:self.appDelegate.initFrame];

self.view = glView;
self.appDelegate.canvas = glView;

core_init_gl(1);

glView.backgroundColor = [UIColor redColor];
glView.translatesAutoresizingMaskIntoConstraints = NO;


[glView.leadingAnchor constraintEqualToAnchor:glView.safeAreaLayoutGuide.leadingAnchor].active = YES;
[glView.trailingAnchor constraintEqualToAnchor:glView.safeAreaLayoutGuide.trailingAnchor].active = YES;
[glView.topAnchor constraintEqualToAnchor:glView.safeAreaLayoutGuide.topAnchor].active = YES;
[glView.bottomAnchor constraintEqualToAnchor:glView.safeAreaLayoutGuide.bottomAnchor].active = YES;





int w = self.appDelegate.screenWidthPixels;
int h = self.appDelegate.screenHeightPixels;
tealeaf_canvas_resize(w, h);

NSLOG(@"{tealeaf} Created GLView (%d, %d)", w, h);

}

The red color goes inside the top notch. I mean full screen. How to solve this?



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
Share:

No comments:

Recent