UIViews Overlay

How can I overlay two layers of UIView for iPhone? The backing should be active until the button is pressed, then another UIView should all in a transparent way. I found Modal View Controllers, but they just share UI-Views, but they don't overlap.

Thanks in advance.

Chris

+3
source share
2 answers

You must use [existingView addSubview:newView];to add a view to an existing view. newView will appear on top of the existing one. Thus, conceptually, you would create a button on an existing screen, connect it to IBAction, which calls this method:

CGRect newSize = CGRectMake(0.0f ,0.0f, 320.f, 400.0f);
UIView *newView = [[UIView alloc] initWithFrame:newSize];
[existingView addSubview:newView];
[newView release];

newView .

+5

- 3- ARC- UIView

_overlayView = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds];
  _overlayView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.5];
    [self.view addSubview:_overlayView];
+2

Source: https://habr.com/ru/post/1708616/


All Articles