Problem with hiding status bar on iphone app, screenshot included - iphone

Im getting this blue line when i try to hide the status bar, I'm using the following line in the touchesBegan method in my RootViewController
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
http://i.stack.imgur.com/GBCgX.png

Thiis is really simple. forget about coding it. just do it right at the beginning this make it a lot more simple and less messier. I do it all the time for every single application I've created.
Go into your project in xcode, then in the Groups and Files section find a file called yourapplicationname-info.plist.
Double cick that and a box opens. It contains properties for your file in the form of a table. Click on the last row once so that the last row is highlighted in blue. Click on the plus arrow on the right end. This will add a new row. A list appears, scroll down to Status bar is initially hidden and click enter to select it. Then an empty box appears next to the name. Tick the box and click CDM+S to save the plist. close the box and get back into xcode. Now take your code off where you try to hide the status bar.
Then click on the view, the .xib file and click with your mouse the actual view so it is in focus (the window that we are currently looking at). Then hit cmd+3 to open up the attributes section. Where it says status bar select the option and select unspecified. Now this will get rid of the status bar on the uiview. What might happen after selecting that optiion is decrease the size of the actual view by 20 pixels. thats the height of the status bar. what you want to do is readjust the view to compensate for the missing status bar. so while still having the view in our focus. hit cmd+3 this will open up the view size. change the H (height) from 300 to 320. And this will readust the screen by adding the 20 pixels which we lost by removing the status bar. Then save and close interface builder and youre done.
Hope this helps
Let me know if it does. Thanks
PK

If your view controller is embedded in a nav controller:
[CODE]self.navigationController.navigationBar.frame = CGRectOffset(self.navigationController.navigationBar.frame, 0.0, -20.0);[/CODE]
Put that in the view did load method on the first view controller your app sees. Finally a solution to this frustrating problem!!!!!

It looks like you have to adjust you view to take up the space formerly occupied by the status bar. You can probably do this using springs and struts in Interface Builder, or you can adjust the view's frame just before or after your call to setStatusBar: withAnimation:.

k then you have to do in appdelegate class
[application setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
it works fine for me... hope this will help you≥

Related

How can I animate this custom view transition in my iPhone app?

This is a tricky question to explain, but basically I have an app with a home screen with a bunch of circular icons on it. When the user taps on an icon, it pushes a table view onto the navigation stack. When an icon is tapped on the home screen, I want the tapped icon to stay on top of the table view as it scrolls in, and then drop onto the table view in the cell that represents it. All the other icons, however, should stay below the incoming table view, like normal. Here's a quick diagram I whipped up...
I'm about to begin researching this, I just wanted to quickly post this question in case anyone has some ideas about how I can approach this. Thanks so much for your wisdom!
Oh thats soo easy!!!
I'll try to explain my solution:
You need two sets of icons.
One set lays on Home View, second is exact location, but as a subview on main window (by default - hidden)
Once You select a button, and want to push a list - You un-hide corresponding window subview icon, and with delay - animate / shrink it to tableView corresponding location.
Once animation is finished - hide icon (instant hide will not be noticeable, as this icon will be positioned/scaled to precisely reassemble icon in tableview), and move it to default position/scale (still hidden).
That's it.
This is pretty simple, and can be done without adding second instances of your buttons. You'll use the view hierarchies z-index for this.
When you add the table view as a subview of the main view don't use addSubview, use:
[self.view insertSubview:table belowSubview:button];
Button^ will represent the button that you want to stay on top, and for your other buttons, you just have to make sure that they are lower on the stack. This way, when the table flies in, it can keep going past the button but the button will stay above it.
You can also use:
[self.view insertSubview:table atIndex:5];
On all of these buttons and the table to have total control over each objects z-index.

Loading screen is not working properly

In my app I am showing loading screen when request is sent to server and when response is received I am removing that loading screen.
To display loading screen I used UIView and reduce its alpha to 0.5 so that it shows the background view.
My problem is user is able to click button displayed on background view when loading screen is still visible.
What I want is: User should not be able to click anywhere on the screen when loading screen is visible. Even though I made userInteractionEnabled false for UIView but still user is able to click on button, why?
If any one knows where I am doing wrong and how I can achieve this, please let me know.
Thanks in advance!
The UIView may have interaction disabled but if the button is higher on the view hierarchy then its on TOP of the view so it's still accessible.
If this is a view made in the nib then make sure its at the top of the view stack
Or if its programmatically then add it as a subview at the end of the function or add it mainWindow (be VERY careful adding things to main Window, this is the top of the hierarchy)
Like wise the utility open source library available.
iOS open source project is MBProgressHUD,
it refers to Heads Up Display, a view that is overlayed on another view, typically to show an activity indicator and/or offer a means to interact with the UI. A good example of an HUD is when playing a movie with the built in movie player. When you tap the screen, the movie player will show a series of controls on the display. Another common example, and one that is pertinent to MBProgressHUD, is showing progress indicators on top of an existing view. For example, when accessing a remote service, to provide feedback to the user you may opt to display a “Please Wait” message
you can download the source code from here.
Yes I got it, I did userInteractionEnabled false for UIView so the click event was sent to the button which was on main view.I removed userInteractionEnabled false and it is working fine.
You can use [[UIApplication sharedApplication] beginIgnoringInteractionEvents] when you are sending request to server & shows loading view.When you receives the response call [[UIApplication sharedApplication] endIgnoringInteractionEvents] & remove the loading view.

UIStepper does not move up when Navigation Bar dissapears

I am writing a IPhone App. In it there is a search bar (UISearchBar with Controller). When I select it, it gets focussed, and the navigation bar disappears, and the body gets darkened so that when I type on search bar the suggestions (search results) appear. My problem is when I select the search bar, before I type anything, I can see my original view through a tinted black body area. There I see all of my other controls (buttons, textfields) moved up (because navigation bar disappeared), but the UISteppers have not moved, which makes them misaligned.
Why is this ?
It may depend on how you have the relative alignment setup. In your Storyboard, use the Inspector (the ruler icon on the right hand side options) and see if you have set the others to be relative.
I believe this is a bug. I have noticed the same exact behavior in several apps I have worked on (both iPad and iPhone) Storyboard based apps. I have re-produced this behavior on apps with only one orientation. To re-produce, simply layout a scene and add UI elements of different types with at least one UIStepper. Then add the scene to a Nav Controller and all the UI elements will move EXCEPT for any UISteppers.

Button has moved upwards when running app in Simulator

I have a strange problem when developing for the iPhone
There is one window (in green) and one view (in orange)
when I try to test my app it looks like this in the iPhone Simulator
you can see the view have moved upwards
is this normal? and how to solve the problem?
many thanks
You're most likely adding the view incorrectly. You could post some code and I could give you a better idea, or if you just want a quick fix, open the orange view in Interface Builder, make it 480 px tall instead of 460, show the simulated status bar and relayout your image.
In Interface Builder you can specify the simulated User interface elements. In the screenshots above you will notice in the green one you can see the status bar and the red one doesn't have it. You can turn on these elements by setting the properties of the view. Press Command-1 when you have the view selected and you will see a list of simulates ui elements you can add, these include the status bar, navigation controller bar and a few others i cant remember off the top of my head. This will allow you to position your ui elements correctly when you have these other elements on the screen.
The other issue with your view is that it is not the same height. have a look at the dimensions (cant remember exactly which one but its Command-2, 3 or 4 when you have the view selected) it should be 320x480, i reckon yours is 320x460... (20 pixels, the height of the status bar)

Full Screen Image Preview

Can someone please tell me how to get a full screen image preview view when someone taps on an image view of a nib... like the one in appstore application screenshots....
it will be a real help...
Thanks in advance
The first thing you need to do is subclass UIImageView.
Then in your subclass make sure that user interaction is enabled (either by setting it in code, or by checking the box in IB).
Then you need to override the touches:DidBeginWithEvent: (et al) methods (they're found in UIResponder), and put the code for what you want to happen inside them. For example, you could create a larger image view, and then attach it to the view hierarchy.
As for making it completely fullscreen, you'd need to set the frame of the image view to that of the Window, and hide any Tab Bars, Navigation Bars, Status bars, etc.
You can hide the status bar by using
[[UIApplication sharedApplication] setStatusBarHidde:YES];
Hide navigation bars:
[navigationController setNavigationBarHidden:YES];
so on and so forth. You should be able to find ways to hide most things by looking at their docs.
Hope this helps.
I actually wanted a control like the image preview in photos and that on facebook maybe....
which i found in the open source three20 repository... google it to find out ....