View controller is obscured when pushing a navigation controllerHow can I make a UITextField move up when the keyboard is present - on starting to edit?reset previous navigation controller in tab bar applicationPassing Data between View ControllersPushing a new view on a navigation controller from a cell's view controllerContent falls beneath navigation bar when embedded in custom container view controller.UITabbarController layout issues in iOS 7 - view going behind the navigation barhow to push a view controller to a navigation controller in a tab bar in iOSPushing a view onto the Navigation Stack from a view inside a container view?embedding navigation controller in tab controller hides the navigation items in view controllerUICollectionView setting Frame
Printing a list as "a, b, c." using Python
Why did the population of Bhutan drop by 70% between 2007 and 2008?
Why does this London Underground poster from 1924 have a Star of David atop a Christmas tree?
What is the sound/audio equivalent of "unsightly"?
Generic Extension Method To Count Descendants
I feel cheated on by my new employer, does this sound right?
Does Dovescape counter Enchantment Creatures?
Notice period 60 days but I need to join in 45 days
Do application leftovers have any impact on performance?
Why did Starhopper's exhaust plume become brighter just before landing?
Did ancient peoples ever hide their treasure behind puzzles?
Are spot colors limited and why CMYK mix is not treated same as spot color mix?
Can a network vulnerability be exploited locally?
What does "-1" represent in the value range for unsigned int and signed int?
SVO airport, how to avoid scam taxis without pre-booking?
How could a self contained organic body propel itself in space
Why is "I let him to sleep" incorrect (or is it)?
Convert shapefille to KML
Heat output from a 200W electric radiator?
What should be done with the carbon when using magic to get oxygen from carbon dioxide?
Cauterizing a wound with metal?
Normalized Malbolge to Malbolge translator
Get contents before a colon
Why do IR remotes influence AM radios?
View controller is obscured when pushing a navigation controller
How can I make a UITextField move up when the keyboard is present - on starting to edit?reset previous navigation controller in tab bar applicationPassing Data between View ControllersPushing a new view on a navigation controller from a cell's view controllerContent falls beneath navigation bar when embedded in custom container view controller.UITabbarController layout issues in iOS 7 - view going behind the navigation barhow to push a view controller to a navigation controller in a tab bar in iOSPushing a view onto the Navigation Stack from a view inside a container view?embedding navigation controller in tab controller hides the navigation items in view controllerUICollectionView setting Frame
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have a navigation controller and a view controller inside of the navigation controller.
The view controller calls the navigation controller to push a view:
`MYVC *myvc = [MYVC new]`;
`[self.navigationController pushViewController:myvc
animated:YES]`;
Inside of MYVC I have the following logic for laying out my collection view:
- (void)viewDidLayoutSubviews
[super viewDidLayoutSubviews];
_collectionView.frame = CGRectMake(0,
0,
self.view.frame.size.width,
self.view.frame.size.height - height);
This works fine for when I first load my vc as the collection view is loaded under my nav bar.
However when I push my vc it looks like the following: 

Above the divider line is my nav bar and the red is my colleciton view.
It looks like the collection view is laid out under my navigation bar. If I drag on my collection view it lays out properly.
If I try changing the _collectionView frame's y position to self.navigationController.navigationBar.frame.size.height however I get a large whitespace above my collection view after I drag on my collection view. How can I get it to be laid out properly the first time? Do I have to force layout? Is there some reason my nav bar isn't taken into account for the vc until I drag in the scroll view?
ios objective-c layout viewcontroller
add a comment |
I have a navigation controller and a view controller inside of the navigation controller.
The view controller calls the navigation controller to push a view:
`MYVC *myvc = [MYVC new]`;
`[self.navigationController pushViewController:myvc
animated:YES]`;
Inside of MYVC I have the following logic for laying out my collection view:
- (void)viewDidLayoutSubviews
[super viewDidLayoutSubviews];
_collectionView.frame = CGRectMake(0,
0,
self.view.frame.size.width,
self.view.frame.size.height - height);
This works fine for when I first load my vc as the collection view is loaded under my nav bar.
However when I push my vc it looks like the following: 

Above the divider line is my nav bar and the red is my colleciton view.
It looks like the collection view is laid out under my navigation bar. If I drag on my collection view it lays out properly.
If I try changing the _collectionView frame's y position to self.navigationController.navigationBar.frame.size.height however I get a large whitespace above my collection view after I drag on my collection view. How can I get it to be laid out properly the first time? Do I have to force layout? Is there some reason my nav bar isn't taken into account for the vc until I drag in the scroll view?
ios objective-c layout viewcontroller
It seems to me that the issue might be related to the fact that the view controller is actually under the navigation bar. I'm not push why that would be the case as the view controller is inited in the navigation bar.
– MichaelGofron
Mar 28 at 14:02
Anyone have any ideas or can point me to a similar case where this happens? I haven't found anything on SO
– MichaelGofron
Apr 2 at 19:06
add a comment |
I have a navigation controller and a view controller inside of the navigation controller.
The view controller calls the navigation controller to push a view:
`MYVC *myvc = [MYVC new]`;
`[self.navigationController pushViewController:myvc
animated:YES]`;
Inside of MYVC I have the following logic for laying out my collection view:
- (void)viewDidLayoutSubviews
[super viewDidLayoutSubviews];
_collectionView.frame = CGRectMake(0,
0,
self.view.frame.size.width,
self.view.frame.size.height - height);
This works fine for when I first load my vc as the collection view is loaded under my nav bar.
However when I push my vc it looks like the following: 

Above the divider line is my nav bar and the red is my colleciton view.
It looks like the collection view is laid out under my navigation bar. If I drag on my collection view it lays out properly.
If I try changing the _collectionView frame's y position to self.navigationController.navigationBar.frame.size.height however I get a large whitespace above my collection view after I drag on my collection view. How can I get it to be laid out properly the first time? Do I have to force layout? Is there some reason my nav bar isn't taken into account for the vc until I drag in the scroll view?
ios objective-c layout viewcontroller
I have a navigation controller and a view controller inside of the navigation controller.
The view controller calls the navigation controller to push a view:
`MYVC *myvc = [MYVC new]`;
`[self.navigationController pushViewController:myvc
animated:YES]`;
Inside of MYVC I have the following logic for laying out my collection view:
- (void)viewDidLayoutSubviews
[super viewDidLayoutSubviews];
_collectionView.frame = CGRectMake(0,
0,
self.view.frame.size.width,
self.view.frame.size.height - height);
This works fine for when I first load my vc as the collection view is loaded under my nav bar.
However when I push my vc it looks like the following: 

Above the divider line is my nav bar and the red is my colleciton view.
It looks like the collection view is laid out under my navigation bar. If I drag on my collection view it lays out properly.
If I try changing the _collectionView frame's y position to self.navigationController.navigationBar.frame.size.height however I get a large whitespace above my collection view after I drag on my collection view. How can I get it to be laid out properly the first time? Do I have to force layout? Is there some reason my nav bar isn't taken into account for the vc until I drag in the scroll view?
ios objective-c layout viewcontroller
ios objective-c layout viewcontroller
edited Mar 27 at 22:53
rmaddy
259k29 gold badges351 silver badges416 bronze badges
259k29 gold badges351 silver badges416 bronze badges
asked Mar 27 at 22:01
MichaelGofronMichaelGofron
6532 gold badges10 silver badges21 bronze badges
6532 gold badges10 silver badges21 bronze badges
It seems to me that the issue might be related to the fact that the view controller is actually under the navigation bar. I'm not push why that would be the case as the view controller is inited in the navigation bar.
– MichaelGofron
Mar 28 at 14:02
Anyone have any ideas or can point me to a similar case where this happens? I haven't found anything on SO
– MichaelGofron
Apr 2 at 19:06
add a comment |
It seems to me that the issue might be related to the fact that the view controller is actually under the navigation bar. I'm not push why that would be the case as the view controller is inited in the navigation bar.
– MichaelGofron
Mar 28 at 14:02
Anyone have any ideas or can point me to a similar case where this happens? I haven't found anything on SO
– MichaelGofron
Apr 2 at 19:06
It seems to me that the issue might be related to the fact that the view controller is actually under the navigation bar. I'm not push why that would be the case as the view controller is inited in the navigation bar.
– MichaelGofron
Mar 28 at 14:02
It seems to me that the issue might be related to the fact that the view controller is actually under the navigation bar. I'm not push why that would be the case as the view controller is inited in the navigation bar.
– MichaelGofron
Mar 28 at 14:02
Anyone have any ideas or can point me to a similar case where this happens? I haven't found anything on SO
– MichaelGofron
Apr 2 at 19:06
Anyone have any ideas or can point me to a similar case where this happens? I haven't found anything on SO
– MichaelGofron
Apr 2 at 19:06
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55387145%2fview-controller-is-obscured-when-pushing-a-navigation-controller%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55387145%2fview-controller-is-obscured-when-pushing-a-navigation-controller%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
It seems to me that the issue might be related to the fact that the view controller is actually under the navigation bar. I'm not push why that would be the case as the view controller is inited in the navigation bar.
– MichaelGofron
Mar 28 at 14:02
Anyone have any ideas or can point me to a similar case where this happens? I haven't found anything on SO
– MichaelGofron
Apr 2 at 19:06