Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-05-2011, 02:32 PM   #1 (permalink)
Registered Member
 
Join Date: Jul 2011
Location: Marquette, MI (in the beautiful Upper Peninsula)
Posts: 111
john love is on a distinguished road
Default How do I determine that UIView is showing with navigation bar on top

I know that the presence of the more view controller (navigation bar) pushes down the UIView by its height. I also know that this height = 44px. I have also discovered that this push down maintains the [self.view].frame.origin.y = 0.

So how do I determine the height of this navigation bar, other than just setting it to a constant?

Or, shorter version, how do I determine that my UIView is showing with the navigation bar on top??

Thx.
john love is offline   Reply With Quote
Old 09-05-2011, 02:58 PM   #2 (permalink)
Reading the Documentation
 
baja_yu's Avatar
 
Join Date: Sep 2010
Location: 45.255019,19.844908
Posts: 5,414
baja_yu has a spectacular aura about
Default

If the height of the view's frame is less that the height of the screen, then you have the navigation bar. Also, if the navigation controller is present, you can access the navigation bar through and check it's height. Keep in mind that the status bar can also be present and it can subtract from the total height as well.
baja_yu is offline   Reply With Quote
Old 09-06-2011, 08:20 AM   #3 (permalink)
Registered Member
 
Join Date: Jul 2011
Location: Marquette, MI (in the beautiful Upper Peninsula)
Posts: 111
john love is on a distinguished road
Default

Quote:
Originally Posted by baja_yu View Post
If the height of the view's frame is less that the height of the screen, then you have the navigation bar. Also, if the navigation controller is present, you can access the navigation bar through and check it's height. Keep in mind that the status bar can also be present and it can subtract from the total height as well.
Thanks.

I've seen articles that confirm your statement on the status bar ... but ... my NSLogs indicate that the status bar has no effect. So, I don't know what is going on.
john love is offline   Reply With Quote
Old 09-07-2011, 08:12 AM   #4 (permalink)
Registered Member
 
Join Date: Jul 2011
Location: Marquette, MI (in the beautiful Upper Peninsula)
Posts: 111
john love is on a distinguished road
Default

The light bulb started to come on. Unfortunately, I have not discovered a uniform way to correct the problem, as described below.

I believe that my whole problem centers on my autoresizingMasks. And the reason I have concluded that is the same symptoms exist, with or without a UIWebView. And that symptom is that everything is peachy for Portrait. For Landscape, the bottom-most UIButton pops down behind the TabBar.

For example, on one UIView, I have, from top to bottom:

UIView – both springs set (default case) and no struts

UIScrollView -
If I set the two springs, and clear everything else (like the UIView), then the UIButton intrudes on the object immediately above it.
If I clear everything, then UIButton is OK, but the stuff at the very top hides behind the StatusBar
Setting only the top strut, the UIButton pops down behind the Tab Bar.

UILabel and UIImage next vertically – top strut set, flexible everywhere else

Just to complete the picture for the few that have a UIWebView:

UIWebView -
Struts: top, left, right
Springs: both

UIButton – nothing set, i.e., flexible everywhere

Although my light bulb is dim, there appears to be hope.

Last edited by john love; 09-10-2011 at 05:13 AM.
john love is offline   Reply With Quote
Old 09-09-2011, 12:15 PM   #5 (permalink)
Registered Member
 
Join Date: Jul 2011
Location: Marquette, MI (in the beautiful Upper Peninsula)
Posts: 111
john love is on a distinguished road
Default

After about 2 weeks on tackling this, I decided that the "problem" was made more difficult by placing a UIButton BELOW the UIWebView sub-view. So, I put the button ABOVE it.

Quite frankly, it just doesn't look "right" that way ... but it now works SORT OF. BELOW or ABOVE the UIWebView has set the top strut and just the horizontal spring.

BTW, its the contentHeight of the UIWebView that does not change with rotation. And that's still true even with button ABOVE.

Set top strut and set the two springs - problem solved and thanks bunches.

As a matter of fact, my only remaining problem is to design those cursed @2X, etc. graphics. I use GraphicConverter in a very simple way and it does well for Web Page design, very well. But all these 30px, 57px stuff - I'm going into unchartered territory for me, at least.

Last edited by john love; 09-10-2011 at 05:14 AM.
john love is offline   Reply With Quote
Reply

Bookmarks

Tags
uinavigationbarcontroller

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 383
7 members and 376 guests
apatsufas, JackReidy, jeroenkeij, Sami Gh, tim0504, yomo710
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,671
Threads: 94,121
Posts: 402,903
Top Poster: BrianSlick (7,990)
Welcome to our newest member, JackReidy
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:50 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0