I am working on iPad landscape only version. I added splitViewController and assigned a viewController as detail view. I am using this view controller out side the splitViewController also as a full view viewController.
Problem : viewController is not resizing when its in splitViewController as detil view. i.e anyting which is on right corner of the view is out of visibel area.
P.S : I am using storyboard with autolayout ,Xcode 5.1
I solved by removing and adding back the view programmatically .
[self.segmentButtonBgView removeFromSuperview];
[self.segmentButtonBgView setTranslatesAutoresizingMaskIntoConstraints:YES];
[self.segmentButtonBgView setFrame:CGRectMake(self.segmentButtonBgView.frame.origin.x-158, self.segmentButtonBgView.frame.origin.y,405, self.segmentButtonBgView.frame.size.height)];
[self.view addSubview:self.segmentButtonBgView];
All subviews of segmentButtonBgView will resize if you have set constraints.
Related
Here is my question like I am having a storyboard called Tabbar.storyboard and another storyboard called Main.storyboard. Tabbar.storyboard is my initial storyboard and application starts with that storyboard. Now when I move from Tabbar storyboard to Main storyboard with enabled hidebottombarwhenpushed, Tabbar hides successfully but left an empty view instead.
I also put hidebottombarwhenpushed in my viewcontroller in which I pushed from tabbar controller but nothing worked
here is my of Tabbar storyboard.
Here is my in simulator.
Here when I push from Tabbar storyboard to main storyboard Tabbar is hidden but left an empty view. of simulator where you see an empty view at bottom.
Any help would be appreciated.
If you are using constraints, check if the bottom constraint of your UICollectionView [?] in your UIViewController are being set to "bottomLayoutGuide" (also check if "use safe area" option is checked/unchecked).
Using the XCode's view debugger is also helpful. Try to see where are the bounds of your views, and check if some constraints aren't being broken.
Recently I ran into an issue with my app when changing the device's orientation.
This is my main ViewController (let's call it VC1) in portrait mode:
Now if you push / present any viewcontroller (let's call that VC2), rotate the screen while in VC2, and return back to the previous view (VC1), this is what I get:
Why doesn't VC1 rotate correctly like it should? This issue happens throughout the whole app and with any two views. I honestly have no idea what might be causing this or where to look, so any help would be appreciated.
Do you use constraints and autolayout? Can you post a screeen where constraints of the view are visible? I think there are some missing constraints
your navigation bar is properly resize in portrait and landscape mode So The main problem is you didn't add trailing Constraints to your view.
Just Add you trailing constraints on your view in Storyboard.
After updating device to iOS 8 the next issues with layout occur.
I have an UITabBarController which contains two UITableViewController embedded in UINavigationController. This is main view.
Also there are several UIViewControllers designed in StoryBoard (not embedded in UINavigationViewControllers). These are secondary views. All of them have "Hide Bottom bar on Push" set to YES. Constraints are set to determine layout.
All secondary views are shown with:
UIStoryboard* sb = [UIStoryboard storyboardWithName:STORYBOARD_NAME bundle:nil];
UIViewController* secondaryView = [sb instantiateViewControllerWithIdentifier:_name];
[navigationController pushViewController:secondaryView animated:YES];
All works fine on iOS7.
But with iOS8 there are some problems when secondary view controller appears:
All pinned to bottom UIViews are shown on wrong places for a moment and then "jump" to correct place. Looks like first position is calculated including bottom bar (which is hidden due to "Hide on Push")
If there is UITableView as subview: top pinned subviews again are show on wrong place for a moment and then "jump" to correct place. Looks like first position is calculated not including navigation bar size. If i remove UITableView from controller - all works fine (except p.1)
Tried to set Simulated metrics for secondary views - did not help.
These "jumps" are really annoying. Would appreciate for any advices.
I had a similar problem with jumping when hiding the tab bar from the Storyboard.
Make sure your bottom subviews are pinned to the superview rather than the Bottom Layout Constraint.
You have to do this from the menu - Editor - Pin - Bottom Space to Superview, because the Auto Layout menu in Interface Builder pins to Bottom Layout Constraint by default.
As far as i experienced iOS 8 have issue in tabbar controller mixed with navigation bar controller .. removing one of them will make it run ok again.
i'm using storyboard for present my interface, this view controller show from mapView through modal segue, but after i change orientation in view scroll is not working
Any idea? Please, help
is it possible to have a common view for both master and detail view controllers.
What if I need to add a header image(at top, the very first view) common for both the master and detail view controllers. When the device is in the portrait mode the width of the header image view has to shrink to fit to the detail view controller's view and when the orientation changes to landscape the width of the same header image view has to be expanded that is the width of it has to be 1024. Please tell me whether doing this is possible. or any workaround for this?
I'm not sure about this, but you may need to explicitly set the image using a UIImageView in your DetailViewController and your RootViewController NIB. Then, during an Orientation change (Portrait -> Landscape), the UIImageView in the DetailViewController should automatically flip with the rest of the ViewController, giving you what you are looking for.
A splitViewController must be root view controller in your application. If you add splitViewController's view as a subview of some other viewController's view, splitViewController will not get the rotation events.
For your problem, change the design of your app so that the common view appears only in detailViewController part so that it will appear in portrait mode also.
If this is not feasible, the only option you are left with is to create your own splitViewController, so that you will be capable of adding it over some other views and send the rotation events to this splitViewController when rotation occurs.