In mobile app development, sometimes we face a problem where we had to add a view before our UITabbarController
in an application that based on TabBarController
means which has a tab at the bottom of screen .To solve this, we will made a view programmatically and then add that code to our applicationDidFinshLaunching
method in our Appdelegate.m
class. Below is the code snippet
UIView *myView = [[[UIView alloc] initWithFrame:CGRectMake( 0, 20, 320, 460 )] autorelease]; myView.backgroundColor = [UIColor redColor];
Now create a button on the myView so that we can remove it and show our home screen when user press it.
You can create a button to remove the view by using the code
UIButton *startButton = [UIButton buttonWithType:UIButtonTypeCustom];
startButton.frame=CGRectMake(118, 409, 88, 37);
[startButton addTarget:self action:@selector(startApp) forControlEvents:UIControlEventTouchUpInside];
Now we have to write down the method which we gave to our button to remove myView and allow user to navigate to home screen
Summary:In the above post we learned, how to show a screen before a rootView in an application that based on TabBarController.
Hope it helps…