Search code examples
iphoneiosobjective-cfooter

Showing a custom view on entire project as a footer


My project architecture is a 'Master Detail' and i want to show a footer through out all the viewcontrollers or tableviewcontrollers that i navigate.

Please help me to find the way.


Solution

  • you can add it this way and instead of UIView use your customView's object to achieve your goal.

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
        // Override point for customization after application launch.
        self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
        self.navMain = [[UINavigationController alloc] initWithRootViewController:self.viewController];
        self.window.rootViewController = self.navMain;
        [self.window makeKeyAndVisible];
    
        UIView *viewFooter = [[UIView alloc] initWithFrame:CGRectMake(0, 431, 320, 49)];
        [viewFooter setBackgroundColor:[UIColor redColor]];
        [self.window addSubview:viewFooter];
        [self.window bringSubviewToFront:viewFooter];
    
        return YES;
    }