Orientation Issue in iPad? - ios

I am working in iPad application, Using UITabBarController to create this application like four tabbar are A,B,C and D. All tabbar set Landscape orientation, When i select 3rd tab and press Submit Button to hide tabbar at the time and navigate to another screen (Pdf_reader.m).
I have set all the orientation in (Pdf_reader.m) class and its navigate portrait, then click back barbutton to go ClassC.m showing portrai mode, but i want Pdf_reader screen only rotate all orienatation, all the tabbar set Landscape mode, How to fix this issue?
ClassC.m //Hide tabbar
-(void)Submit
{
PDFExampleViewController *open = [[PDFExampleViewController alloc]init];
open.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:open animated:YES];
}

Check out the answers in this question. There are a few things you have to watch out.

Related

How to implement hiding the UITabBar to display an UIToolbar on iOS 11 and iPhone X

I'm trying to do an UI similar to the Photos app, where when you enter in a selection mode that hides the tab bar to display a toolbar.
I have my view controller in a UINavigationController and the navigation controller in a UITabBarController.
I had other strategies before but I'm struggling to get this working on the iPhone X and its bottom safe margins.
If I'm making the correct assumptions based on your description of the Photos App, I think you may be confused as to what the app is doing behind the scenes when going from Photos App TabBar to Photos App Toolbar.
These are two different ViewControllers, the second only shows the toolbar and sets hidesBottomBarWhenPushed = true in the init. You can use the NavigationController's supplied toolbar by setting the setToolbarItems(toolbarItems: [UIBarButtonItem]?, animated: Bool) in your second ViewController. This properly sizes the toolbar in the view to account for the bottom control on the iPhoneX.
If you must manage toolbar and TabBar visibility in the same ViewController, based on my testing, you'll need to add/manage the toolbar manually within a UIView container to get the proper size on all devices. So the view hierarchy would be ViewController.view -> toolbarContainer View -> Toolbar.
for iPhone X, the tab bar height is different than iPhone 8, you need to track
static CGFloat tabBarMaxHeight = 0;
- (void)setToolbarHidden:(BOOL)hidden {
[self.navigationController setToolbarHidden:hidden animated:NO];
CGRect frame = self.tabBarController.tabBar.frame;
tabBarMaxHeight = MAX(tabBarMaxHeight, CGRectGetHeight(frame));
frame.size.height = hidden ? tabBarMaxHeight : 0;
self.tabBarController.tabBar.frame = frame;
self.tabBarController.tabBar.hidden = !hidden;
//! reset tab bar item title to prevent text style compacted
for (UITabBarItem *obj in self.tabBarController.tabBar.items) {
NSString *title = obj.title;
obj.title = #"";
obj.title = title;
}
}

UITabbar View overlap title on image after present the another UIViewController

I am using the UITabbarview with for item. For every tabbar item I am using the image and title.
Its perfect when I come that TabbarViewcontroller screen and navigate to another to anther UIViewcontroller by push.
But if i navigation to another UIViewController by present then come back to same TabbarviewController screen then title overlap on image of bar item.
like the images
Now I am not able to understand, why this happening and how to resolve this issue.
use this code in your "viewWillAppear" method.
-(void)viewWillAppear:(BOOL)animated
{
[UITabBarItem appearance].titlePositionAdjustment = UIOffsetMake(0, -3);
}
Select tab bar icon and choose image inset all = 0

Uitabbarcontroller won't respond on touching on the title of the tabbar in iPhone 5

I'm adding a tabbarcontroller to the main view controller. If I touch the title below the image logo of the tabbar it won't respond. If I click the image of the tabbar, it gets a click and selected. This issue is only iPhone 5(4 inch screen). But it works fine in 3.5 inch device.
Please, refer the below the image, area inside red border won't respond to touch for all tabbars.
Same issue occurs in both device a.w.a simulator. I remember a post with full tabbar click access here in StackOverflow, but can't find it right now. Please suggest a solution for this.
Edit
Based on your comment
I added the tabbarcontroller using, tabctrl.view.frame = CGRectMake(0, 20, 320, 548); [self.view addSubview:tabctrl.view];
You should also initialize the tabBar with window bounds or self.view
or try not setting the view and tabbar will set it itself
Previous Answer
Enable FullScreen for the MainWindow in the utilities inspector
in Main View Controller
-(void) viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
// I assumed that you have created yourTabBarController in View did load
yourTabBarController.view.frame = self.view.bounds;
}

TabBar remains hidden despite setting tabbar.hidden = NO in controller

I currently have two view controllers, a CameraViewController that uses the imagePicker to take photos, and a PhotoInboxViewController that shows all the photo messages a person has received. PhotoInboxViewController, as well as my root view controller, is a Tab Bar Controller.
When I present the imagePicker in CameraViewController , as well as the image preview screen that follows it, I disable the TabBar by setting self.tabBarController.tabBar.hidden = YES. My issue is, when PhotoInboxViewController is then shown again (for example, if the user cancels taking a photo), I would want the Tab Bar to be shown again. In my viewWillAppear method in I have the following:
//In PhotoInboxViewController
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
if ([[[self tabBarController] tabBar] isHidden]){
self.tabBarController.tabBar.hidden = NO;
}
}
In debugging, I see that the if statement is indeed evaluated as tabBar as isHidden, and therefore the next line is executed as well. However, my Tab Bar remains hidden.
What am I doing incorrectly? Your help is appreciated - thanks!
You shouldn't need to hide the tab bar. When presenting modally you should present from the full screen / root view controller. In this case the tab bar controller, not the view controller 'in' one of the tabs. This allows the presentation to work properly without any strange side effects.

Why is [UIViewController presentModalViewController:animated:] transitioning the modal view in from the left?

I'm building an application that supports only Landscape orientation on the iPad under iOS 4.3, though the bug was present under iOS 4.2 as well.
Several places in the application, I am showing UIViewControllers as modal views. All of them are shown using this pattern:
viewController.modalPresentationStyle = UIModalPresentationFormSheet;
viewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:viewController animated:YES];
In most places, they work as expected - the modal form sheet slides in from the bottom of the screen upward.
However, in two cases, the modal form sheet slides in from the bottom left of the screen. The form sheet slides nearly all the way to the right with the bottom of the form sheet out of view. If you focus a text field and show the onscreen keyboard, the form sheet moves to the top center of the screen where you would expect it to be.
I don't think the Simulated Metrics of the XIBs affect their behaviour, but I have set the orientation for all of them (both the calling UIViewController self and the modal view controller viewController) to Landscape.
Any ideas why these two modal form sheets are behaving differently from the others?
I think here you dint return landscape orientation in shouldAutorotate function so use this code if you wan view as landscape left/right:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight||interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
// return YES;
}
Try this it may help you..
Make sure if you have a viewController embedded in a NavigationController that the navController shouldAutotorate is also set to landscape

Resources