If i have a landscape view of 300/200 in an iPad, i want to use navigation for only the small view, is that possible? If yes, an example will be really helpfull
What about this:
MainController *controller = [[MainController alloc] init];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:controller];
[controller release];
[self.navigationController presentModalViewController:navController animated:YES];
navController.view.superview.frame = CGRectMake(0, 0, 300, 300);
[navController release];
Hope this will help you
Related
SecondViewController *testAppViewController2Obj =[[SecondViewController alloc]initWithNibName:#"TestAppViewController2" bundle:nil];
[self.navigationController pushViewController:testAppViewController2Obj animated:YES];
ContainerViewController *container = [[ContainerViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:container];
UINavigationBar *navBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 65)];
container.navigationItem.title = #"Frames";
self.window.rootViewController = nav;
i hope it works
In order to push a new view controller you should first create a view controller, VC1, link it with a navigation controller and then link the navigation controller to the rootViewController in the AppDelegate
#AppDelegate
FirstViewController *VC1 = [FirstViewController new];
UINavigationController *nVC = [UINavigationController alloc] initWithRootViewController:VC1];
self.window.rootViewController = nVC;
Then when VC1 gets pushed, you can create another view controller and push it like this:
#Now in VC1
SecondViewController *VC2 = [SecondViewController new];
[self.navigationController pushViewController:VC2 animated:YES];
I have an application with custom modal view controller and this controller is inside navigation controller here is my code:
CalendarViewController *calendarViewController = [[CalendarViewController alloc] initWithNibName:#"CalendarViewController" bundle:nil];
[calendarViewController setDelegate:self];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:calendarViewController];
[navigationController setModalPresentationStyle:UIModalPresentationFormSheet];
[navigationController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentModalViewController:navigationController animated:YES];
navigationController.view.superview.frame = CGRectMake(0, 0, 630, 555);
navigationController.view.superview.center = self.view.center;
Problem is that this navigation controller is not center on screen. Location of this screen is right side of ipad. Is there a solution how center this custom controller. Thanks a lot.
I'm using MGSplitViewController for my iPad application.
I have added a viewController to it's detailViewController this way:
my2ndVC *vc = [[my2ndVC alloc] init];
splitViewController.detailViewController = vc;
It works perfect, now when I'm adding a navigationBar to my2ndVC
UINavigationBar *navBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, 448, 44)];
[self.view addSubview:navBar];
The bar isn't showing up.
I know I can add my2ndVC like this:
my2ndVC *vc = [[my2ndVC alloc] init];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:vc];
splitViewController.detailViewController = navController;
But then I also have a condition in one of my view controller:
if ([splitViewController.detailViewController isKindOfClass:[my2ndVC class]])
What would be the suggested workaround?
Cant you change your condition as follows:
if ([splitViewController.detailViewController.topViewController isKindOfClass:[my2ndVC class]])
To Make it simpler :
UINavigationController *aNavigationController = (UINavigationController *)splitViewController.detailViewController;
if ([aNavigationController.topViewController isKindOfClass:[my2ndVC class]]) {
// TRUE...
}
There is a UITabBarController
- (void)getToMCGatherViewController
{
mCGatherViewController = [[MCGatherViewController alloc] initWithNibName:#"MCGatherViewController" bundle:nil];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:mCGatherViewController];
navigationController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:navigationController animated:YES];
[navigationController release];
}
In the .h file:
#interface MCGatherViewController : UITabBarController
In the .m file . I want to change the color of the view's navigationBar
- (void)viewDidLoad
{
[super viewDidLoad];
self.navigationController.navigationBar.tintColor=[UIColor greenColor];
}
and it does not work at all.
Help me with this problem , thank you in advance!
just add
[navigationController.navigationBar setTintColor:[UIColor greenColor]];
after
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:mCGatherViewController];
in your getToMCGatherViewController method.
Just edit your code like this and try I think this will work for you.
mCGatherViewController = [[MCGatherViewController alloc] initWithNibName:#"MCGatherViewController" bundle:nil];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:mCGatherViewController];
navigationController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self.view addSubview:nav.view];
Then you change your Navigation Bar tint color.
I want to display a popup window in iPad using the UIView's presentModalViewController method in iOS5.
Even though I set the modalPresentationStyle to UIModalPresentationFormSheet, it only displays as full frame size.
I used the same code in iOS4 before, and it can display as a popup window. How to fix it in iOS5?
DetailViewController *d = [[DetailViewController alloc] initWithNibName:nil bundle:nil];
self.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:d animated:YES];
Thanks.
Have you try
d.modalPresentationStyle = UIModalPresentationFormSheet;
instead of
self.modalPresentationStyle = UIModalPresentationFormSheet;
In iOS5, the modal view should be used as below.
DetailViewController *d = [[DetailViewController alloc] initWithNibName:nil bundle:nil];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:d];
navigationController.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:navigationController animated:YES];