The best way to keep a constant view of all the views in the navigation controller

and thanks in advance.

I am looking for tips on how to compose view controllers in my application, where I still have a constant background and some background animations

Here's how it is currently configured:

  • AppDelegate creates a navigation controller, RootViewController and Sprite Layer (subclasses of UIView)
  • AppDelegate also saves the background image as a backgroundColor property
  • the navigation controller is initialized by the root view controller, as usual.
  • the rootview controller pushes different types of tables onto the navigation stack

And in the code:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

UIImageView* backgroundView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"underthesea.jpg"]] autorelease];
backgroundView.contentMode = UIViewContentModeScaleAspectFill;
backgroundView.frame = [UIScreen mainScreen].bounds;

self.viewController = [[[RootViewController alloc] init] autorelease];
self.navigationController = [[UINavigationController alloc] initWithRootViewController:self.viewController];
self.spriteLayer = [[[SpriteLayer alloc] initWithFrame:self.viewController.view.frame] autorelease];
self.viewController.spriteLayer = self.spriteLayer;

[window addSubview:backgroundView];    
[window addSubview:self.spriteLayer];
[window addSubview:self.navigationController.view];

[window makeKeyAndVisible];
return YES;
}

`

, . , , UIViewController.

, SpriteLayer UIViewController, ; , . , , , , StackOverflow, .

?

Cheers,

P.S. C . , , , , , - . - ? .

+3
2

Bentford, SpriteLayer UINavigation, , UINavigation. :)

, , :

[window addSubview:backgroundView];    
[window addSubview:self.spriteLayer];
[window addSubview:self.navigationController.view];

[self.navigationController.view insertSubview:backgroundView atIndex:0];
[self.navigationController.view insertSubview:self.spriteLayer atIndex:1];
[window addSubview:self.navigationController.view];

autoresizeMask backgroundView poof. + , git, .

!

+5

. UIView SpriteLayer UIViewController.

, UIViewController . SpriteLayer didRotateToInterfaceOrientation.

SpriteLayer UINavigationController, view. - UINavigationController viewDidLoad:

- (void)viewDidLoad {
    [super viewDidLoad];

    SpriteLayer *spriteLayer = [[SpriteLayer alloc] initWithFrame:CGRectMake(0, 300, 320, 50)];
    [self.view addSubview:spriteLayer];

}

SpriteLayer. sendSubviewToBack UIView.

0

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