Is it possible to cover UIStatusBar with a view while maintaining scrollsToTop functionality? - iphone

I want to display a message to the users of my app in the UIStatusBar, but I'd like to maintain the scrollsToTop functionality so a user can tap on the statusbar and scroll a tableView up to the top.
I've looked into adding a UIWindow on top of the current status bar as in this question: Add UIView Above All Other Views, Including StatusBar
But it disables the touches to the status bar.
Note: I've seen several apps that use the statusBar area to display messages such as the "Evernote" app.
Thanks for the help!

Have a look at https://github.com/myell0w/MTStatusBarOverlay. By pressing it it can be toggled to not cover the whole status bar and then you can toch the status bar and get back the scroll-to-top feature.
Here is a screenshot, the left side shows the expanded version, the right side the shrinked one:

Are you hiding the statusBar ? It's unwise to keep it there but draw into its position, because in different countries, with different mobile operators, the statusBar's elements have a little different positions. I've seen app drawing there over status icons. Ugly!
So I guess you want to add a subview at the position of statusBar. Why don't you intercept touch events in that view and send your tableView a message to scroll to the top ?

Related

How to show vertical or horizontal scroller on UIWebView?

I ma using UIWebView to some html content. And some time the data is more in width or height but I have fixed size UIWebView. So for user perspective I want to show scroller vertical or horizontal to indicate the user that there are some more content are available in this view. I am using
[webView.scrollView flashScrollIndicators];
but it show scroller when I touch UIWebView. I want to show scroller by default. Can you suggest how to do this.
Use the scroll view of the webviw like this:
[(YOUR WEBVIEW).scrollView setShowsHorizontalScrollIndicator:YES];
[(YOUR WEBVIEW)scrollView setShowsVerticalScrollIndicator:YES];
You can do one thing that ,use this
- (void) webViewDidFinishLoad:(UIWebView *)webView){
[(YOUR WEBVIEW).scrollView flashScrollIndicators];
}
It Will show the scroll-indicator when downloading of the content will finish and user will easily understand that , there are more content on the bottom of the page.
The answer here is simple - you can't as it is against the human interface guidelines. There is a reason that the only way you can manually get them to show is by calling flashScrollIndicators. Apple didn't intend for you to show them so if you're going to implement this, it's going to be the hard way (subclassing or creating your own UIWebView).
Appearance and Behavior
When a scroll view first appears—or when users interact with it—vertical or horizontal scroll indicators flash briefly to show users that there is more content they can reveal. Other than the transient scroll indicators, a scroll view has no predefined appearance.
A scroll view responds to the speed and direction of gestures to reveal content in a way that feels natural to people. When users drag content in a scroll view, the content follows the touch; when users flick content, the scroll view reveals the content quickly and stops scrolling when the user touches the screen or when the end of the content is reached. A scroll view can also operate in paging mode, in which each drag or flick gesture reveals one app-defined page of content.
Source - iOS UI Element Usage Guidelines

How can I add a toolbar to the top of my iPhone app's screen without it looking like it's upside-down?

when i add a toolbar in IB to the top of the screen, the toolbar style is upside down (border at the top of toolbar and no border at the bottom).
is there any way of changing the toolbar so it looks normal and the border is at the bottom? I cant seem to find a way of doing it in IB, am i going to have to code it?
You're breaking the Human Interface Guidelines if you try and put it at the top.
On iPhone, a toolbar always appears at the bottom edge of a screen or view, but on iPad it can instead appear at the top edge.
So the toolbar always looks like that on iPhone. Breaking the HIG in this way is likely to get your app rejected from the app store.

Is it possible to change the frame origins of an iPhone screen as is done when a statusBar is shown or hidden?

When a UIStatusBar is hidden in an app, the origin of all views is (0, 0), the upper left hand corner of the screen. However, when a statusBar is shown, the origin is still (0, 0) yet the views will move down as not to cover the statusBar.
How is this working? Is it possible to duplicate this effect in code?
Essentially, my end goal is to hide the statusBar and replace it with a UIView at certain points in the app (like the google app). But I have a LOT of views and don't want to have to resize all of them after the statusBar is hidden.
You could create a container view enclosing all your "normal" views and set autoresizing masks everywhere. That way, shrinking your container view will automatically resize everything else. In fact, this is how UIViewControllers work. But be aware that while standard Apple controllers like UINavigationController know how to deal with the status bar, they don't know anything about what you want to do, so they're going to be confused more often than not.
Alternatively, you can always show your own status bar underneath the real one, hiding the latter when needed. But in this case you will have to fight Apple-provided controllers which will try to expand when you hide the status bar. You can also play with a two-window layout where the top window does not overlap the status bar, but I'm not sure it will be any easier.
Since Apple doesn't support any of the above, expect a lot of things to stop working correctly. Perhaps, the very best approach is to rethink your UI design.

How to show status bar on top of custom camera overlay?

I have this critical issue with showing top statusbar on the custom camera overlay which seems impossible for me at the moment. I posted the same question to Apple dev forum but did not get any response for some time now.
In my application, I have a custom overlay view set as the overlay to the UIImagePickerController. At the bottom of the custom overlay view (this is a UIViewController), I have put a toolbar that enables user to click on toolbar items. Since the top statusbar is not shown when the camera opens up, the whole screen get pushed upwards and makes a narrow white color gap between the bottom of the screen and the bottom tool bar.
I am not aware of how to resolve this issue, but I think if we can show the top status bar on the top of the camera then this will be automatically get resolved. Thanks for any answers.
Had a similar problem a while back and all I did was resize my view. Why not try that and see if it works.
If that doesn't work then showing the status bar should be
[[UIApplication sharedApplication] setStatusBarHidden:NO];
Thanks for the tip domino, I found how it should be done from this thread and resize the main uiview to 320x480 instead of default 320x460. Hope this will help someone else. Thanks.
Can't resize UIView in IB

Prevent status bar from receiving touch events

Edit
After further testing, it appears that the part of my button that are not clickable are where the status bar used to be. I'm hiding the status bar with :
// -- Override point for customization after app launch
[[UIApplication sharedApplication] setStatusBarHidden:YES];
Also added the Boolean value to my *-info.plist file:
UIStatusBarHidden=true
Which is awesome because it hides the status bar even as the window animates up. But it's still receiving touches. Any idea on how to disable this?
Original Post
Is there's a bounding box on an application that receives touch events? I created a few sample round rect buttons and placed them in different places in my view. The ones in the center of the view receive touch events (and show the highlighted blue color) but if I place a button near the edges of the view, only parts of them are clickable in the simulator. Is this because of Apples style guidelines? I placed a button exactly where a UITabNavigationItem would appear and only the bottom half of it is clickable.
Simulator has a bug with clickability of the former status bar area. Test on the real device.