UIScrollView Indicator Bar - iphone

I was looking at the Apple docs for UIScrollView and saw that the constants for UIScrollView Indicator bars are "default", "black", and "white". I was thinking about using a scrollView without showing the indicator bar on the side of view. I have a very specific case and the bar is making it look awkward and actually seems to be distracting because of it.
If I have a black background and use a black bar I think this would hide it well. Is there a way to turn it off or move it off screen?
Has anyone done this without Apple rejecting it? Or is this a violation of the HIG in some way?

You can hide scrolling indicators if you want - see showsHorizontalScrollIndicator and showsVerticalScrollIndicator properties in UIScrollView. You can set them in IB as well.

UIScrollView has a couple of properties to disable the scroll indicators. Those are:
showsVerticalScrollIndicator
showsHorizontalScrollIndicator
Set them to NO, either in code or IB, to disable the indicators.

Related

UISearchBar background fading in and out when segue push animates

I created two views that has its transition controlled by a navigation view controller. I have a UIView which contain a UISearchBar. The UIView is then set as the navigation bar's titleView in the first view.
Now, the problem is, whenever I go from the first view to the second view, I can see a light background behind the UISearchBar fading in and out.
I have did a bit of troubleshooting of my own and found that the background belongs to the UISearchBar and not the UIView that contains it. I have also tried many codes to make the UISearchBar background transparent, but none of the codes actually makes it transparent.
Edit: I did a bit more fiddling and found that the colour fading in and out is the colour from the style/tint of the UISearchBar. So if I change the tint to black, it'll darken instead. The only way I see I can fix this is to turn the background of the UISearchBar's alpha to 0, but I can't find any code that can change the alpha of a UISearchBar in a UINavigationBar.
Edit: I really can't find any code to turn the background tint of the UISearchBar to be alpha 0. Does anyone have a workaround or an alternative solution to this?
I realised that the bar is actually the scope bar's background. I'm not sure why it still showed up even though I disabled it. My solution was to set the background image as a transparent image.
[self.searchBar setScopeBarBackgroundImage:[UIImage imageNamed:#"transpixel.png"]];

How to make tableview's content displayed under a transparent navigation bar?

How to make tableview's content displayed under a transparent navigation bar?
Like this:In "Photos" app, albums displayed under navigation bar.
Special thanks
If you use _rootNavigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent; then set correct tableview frame thats it. If you are in xib dont forget to simulate the translucent navigation bar.
One way I have found to accomplish this is by shifting your tableview's superview up to have the origin at {0, 0}. However after researching more several people have said altering the superview (UIViewControllerWrapperView) is a bad idea. However I also have not found any information on why just changing the frame would create problems. I am shifting the superview right now and haven't found any problems related to it yet.
Might be you can set it like this:
[navigationBar setAlpha:0.5f];
For making the navigation bar transparent alone, you can check this post, How to make a Navigation bar transparent and fade out like in the photo app in the iPhone
Also check this How to set the transparency color for Toolbar and Navigation bar using MonoTouch?
I am not sure whether you can add the table view behind the navigation bar. You might have to add it as a subview of self.parentViewController.view.
Another way to do this is by hiding navigation bar and using a transparent tool bar in place of that. This can be added on top of the current view. The only problem is with the back button. You might have to use custom button for that.

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

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 ?

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.

iphone TabBarController, how to resize it to height?

any one know how to resize the TabBar? i want make it 80px height for use my custom background and buttons,and make it more beautiful.
thank you
Don't do it. Why waste extra pixels for a tab bar? Users would much rather have more room for the content. Scale your background and buttons appropriately to fit its current height.
You can't do this with Apple's tab bar. But you could make your own custom tab bar, which is what some other applications do.