Custom uitoolbar gets partly hidden - iphone

I'd like to add a custom UIToolbar to my UIViewController. In Interface Builder I add the uitoolbar at the top of my view, and it looks just fine. However, when I run the app in the Simulator it gets hidden by the default iphone bar (this one with the clock, battery status, etc.).
Here you can see how it looks like:
example http://www.cs.put.poznan.pl/jjurkiewicz/private/uitoolbar_hidden.png
Any ideas?

Seems like you're adding your view at coordinates (0,0), the top left of the screen. The view is then getting drawn behind the status bar. Make sure to add the view in the right position, to place it below the status bar it should be at (0,20)

You shouldn't hide the status bar needlessly - so use the IB inspector on the window/view, and under "Simulated Interface Elements", set status bar to anything bar "None". This should be how a new view is created in IB.

You can always just hide your status bar with the "Status bar is initially hidden" property in your Info.plist

Related

Toolbar at the bottom not showing

I used the xcode4 xib file to design the following UI:
View
Table View
Toolbar
Bar Button Item
Segmented Control
Bar Button Item
Segmented Control
On the design sheet, both Table View and Toolbar show up; but when I run the app in simulator, the toolbar is not showing up.
I tried to make the table view invisible (as a test) and to bring the toolbar to the front. Still the toolbar does not show.
Do you have any idea what I might be doing wrong, and what I should try next? Do I need to do init for the toolbar in the .m file?
Thanks much!
Lu
Have you set the the toolbarHidden property of your UINavigationControllerto NO ? You have to explicitly do this to show the toolbar as it is defaulty set to YES. If this isn't the issue, we need to see some code, especially your toolbar initialization and etc.

Change UINavigationItem Color to Black

I am looking at example provided by Apple called LocateMe. I am basing my application on similar UI flow. In that example the top bar of the screen is black. Looking in the code and xib file I am not able to figure out how did they get that black bar on the top. When I set up my project exactly like them, I get blue bar. Please help.
That particular project did it by setting UIStatusBarStyle to UIStatusBarStyleOpaqueBlack in their Info.plist (which is why you couldn't find it). You can also achieve this in code this way:
[[NSApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque];
EDIT: I re-read your question, and it's not clear whether you're asking about the navigation controller bar or the status bar (which is the bar at the very top of the screen). The above is for the status bar. The Navigation Controller bar was set to black by going to the GetLocationSetupView.xib and selecting the Navigation Bar and selecting the "Black Opaque" style.

In IB why can you not add multiple Bar Button Items?

In Interface builder, create a UIView, then a UINavigationBar and then attempt to add multiple UIBarButtomItems to that Navigation Bar. The resulting hierarchy should be:
- View
- Navigation Bar
- Navigation Item (Title)
- Bar Button Item
- Bar Buttom Item
I can never seem to add the second Bar Button Item. I know it is possible because the Utility Application Template in XCode has it. If I copy and past that Navigation Bar to my XIB it works fine. I am looking to create a NavigationBar with left, right button and middle text.
UPDATE
Another test is to try and add a Bar Buttom Item to the left position. Can't seem to do it for me at least.
What am I missing here?
I have no problem doing this in 3.2 beta 2. Just make sure to drag it to the left or right side. A blue outline will appear where the button will be placed.
Edit:
I've managed to reproduce what you're talking about. When I did it successfully, I dragged the item to the "pretty picture", the graphical representation of the view. When I tried dragging it into the view hierarchy, I ran into your problem. Have you tried dragging the button to the actual Navigation Bar? I hope this is clear, I'm not really sure what to call this window.

How do you set autosizing to flex in Interface Builder?

I have an iPhone project that I started as a Windows-based app and another View-based app. The Window app has a view which I added and I want to make the view fit within the window. In the View app the view is set to stretch.
Here is what it looks like when it is off.
(source: smallsharptools.com)
And here is when it is on.
http://www.smallsharptools.com/downloads/Stackoverflow/autosizing-on.png
I want to click in the middle of the Autosizing box but it does not do anything. What do I have to do in Interface Builder to make the View in a NIB to flex/stretch the view?
Usually when a view is locked down like that, it means that you have some simulated UI elements in place (like a fake nav bar, tab bar, or status bar). Select the top level view and go to the first tab of the inspector to see if any of those are turned on (you'd also see them on the view of course).
When they are all gone then you can change any of the resizing handles you like.
The view that is provided by default has this kind of limitation but you can overcome this by adding another view (you should delete the first view) to your xib and making this view the view of your file's owner. Besides this you would also have to change the height of this new view to 480 pxls.
Hope this helps.
Thanks,
Madhup

Hiding/Showing Status Bar

I'm developing an iPhone app that switches from a table view to a landscape fullscreen view (similar to the YouTube app). When it does so, I want to hide the status bar, then display it again when switching back to the table view. I'm using setStatusBarHidden but that just seems to hide the status bar wihout enlarging the screen area; there's still a blank bar where the status bar was. If set the hidden status bar property in Info.plist then I get the enlarged screen area but when the status bar displays it overlays the view.
How do I hide the status bar in such a way that the full screen is available to my view when it's hidden and only the screen under the status bar when it's displayed?
TIA.
Craig
PS: I copy/edit this question from app discussion. do not find good solution
http://discussions.apple.com/thread.jspa?threadID=1580662&start=15&tstart=0
Your view controller should have wantsFullScreenLayout set to YES, as well as hiding the status bar: See UIViewController reference.
If there is anyone looking for a solution where the above solution does not work (and there is still an annoying blue 20px gap at the top), try putting this in the viewWillAppear on the implementation file of the view controller that you would like the status bar to be hidden.
self.navigationController.navigationBar.frame = CGRectOffset(self.navigationController.navigationBar.frame, 0.0, -20.0);
That literally took me 12 hours or so to fix, and that was the solution, so now i'm spreading the word in case anyone else has this annoying issue.