I have an Iphone application in which I had 10 tab items in the tab bar.
I don't want to add the more button behaviour of the tab bar here.
Instead of that I need to make my tab bar as scrollable.
Can anybody had the idea or links to illustrate this?
Can anybody guide me in the right direction?
But You can not use the UITabbar. You need to create custom UITabbar that behave the same.
Here are links of some projects will help you more.
Infinte Tab Bar
Scrollable Tab Bar
Have you tried looking here?
How to make a horizontal scrollable UITabBar in iOS?
Although, and this is the reason im not writing a comment, i would not use a scrollview, as described in the accepted answer. Instead, i would go for a uipickerview, and rotate it 90 degrees using CGAffineTransformRotate. Let me know if this works.
1) define UIScrollview *scrollview
2) drag and drop scroll view
3) connect instance and delegate in xib
4) set frame of scrollview more so it is scrollable and more than view size
5) add uitabbar as subview to scrollview
[uitabar instance addsubview:scrollview];
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.
I use UINavigationcontroller inside UITabBarController and I have moved the UITabBar to the top .The UITabBar has moved successfully but the problem is, there is about 50px of white space where the tab bar used to be .
Anyone has a solution to this problem????
loop through the subviews of the tabbarcontroller.view until you find the container for the tabbar's inner views, then set the frame of that view to 50px higher than it currently is.
Alternatively, a better solution is not to try and use a tabbarcontroller this way. Just use a standalone UITabBar and implement your own view swapping logic when the tabs are tapped.
Uncheck extended edges in rectangle.
I have a tabbar controller and on touching a button in one of view's navigation right button i want to load a (nav controller + view )on top of it. The view which is on the top of it is semi transparent and i should be able to see the content in the tabbar controller.
I tried using the [self.tabbarcontroller.view addSubview:navController];
I worked perfectly and it is working fine. But when i tried to do the same thing in landscape view it is just occupying half the screen. what should be done ? is there a way to fix this issue
can i use the window to load my new view ? will it occupy the entire screen ? i tried autoresize masks and there is no effect
What is the bounds of the navController/tabbarcontroller? Are you setting correctly to that of the window?
You can output it easily:
NSLog(#"navController bounds: %#",NSStringFromCGRect(navController.view.bounds));
Do you mean addSubview:navController.view? I didn't think you could treat view controllers as views.
In general, you need to be careful when using UIViewController outside of the framework-managed classes. UIKit automatically handles stuff like viewWillAppear/autorotation for the view controllers that it knows about, but it doesn't know about the VCs whose views you randomly add as subviews.
EDIT: If all you require is that it appears to be transparent, you can use something like
UIGraphicsBeginImageContextWithOptions(tabBarController.view.size, 0, 0);
[tabBarController.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
and then use img as the view background. It won't animate the stuff in the background, but provided you don't need this, it's much faster than having lots of transparent views stacked on top of each other.
I am using a navigation controller, and I have the style set to :
navController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
But when I run my program, the navigation controller looks like it is on top of a white background, not my background. When I push a controller, left or right, all my view, the current one, shifts to the top exactly the size of the navigation bar. And it is there where I can see my background through the navigation controller bar. Any ideas? When my barStyle is set to opaque, everything looks fine. I was thinking on setting my view frame a negative 'y' value, but I think there should a more elegant way.
I believe the UINavigationController assumes that your controller view frames don't include the area beneath the navigation bar.
UIBarStyleBlackTranslucent is more often used for UIToolbar, so Apple probably didn't make it easy to use it nicely with UINavigationBar. You'll probably need to abandon the UINavigationController, or start hacking the frames (careful with rotations), if you want to reliably render under the bar area.
Also, if your intention is to hide the navigation bar after a few seconds, you'll have a much easier time if you make it fade out (like the Photos app) instead of trying to slide it up (like Mobile Safari). Trust me on that one... that took me a lot of time to learn the hard way.
Simply use a transparent background image, and translucent = YES to allow the content to flow below the bar. Works on iOS 5 / 6. Add in viewDidLoad.
self.navigationController.navigationBar.translucent = YES;
UIImage * backgroundImage = [UIImage imageNamed:#"spacer.gif"];
[self.navigationController.navigationBar setBackgroundImage:(UIImage *)backgroundImage forBarMetrics:UIBarMetricsDefault];
I attached the spacer.gif image here, a single 1px x 1px transparent image.
self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:0.169 green:0.373 blue:0.192 alpha:0.9];
self.navigationController.navigationBar.translucent = YES;
Note:
Don't use self.navigationBarStyle and self.navigationBarTintColor to change.
Add the last two statements to your viewDidLoad.
I ran into this same problem (in 3.1.3) and while you can't set the bar style after the navigationBar has already been setup you CAN set the tintColor and translucent values whenever you like:
self.navigationController.navigationBar.tintColor = [UIColor blackColor];
self.navigationController.navigationBar.translucent = YES;
Will create the 'blackTranslucent' bar, I change the navigationBar look when I push certain view controllers onto the stack.
I had the same problem, and I solved it by making the background of the root view the same as my view. The white area behind the navigation bar turned out to be the root view.
The navigation controller offsets the coordinate sytem of all it's subviews so they draw below the navigation bar.
Extend your view's frame into the negative y domain for it to draw under the navigation bar.
You need to set the barstyle in your info.plist file for it offset everything correctly.
However, I haven't tried it since the 2.1 f/w was released, but when I tried this in 2.0 I found that the setting was lost after a rotation from portrait to landscape.
try to use this, may be it will helpful.
_topToolBar.barStyle = UIBarStyleBlackTranslucent;
_topToolBar.alpha = 0.3;
I had a same problem.I solved!
ImageViewExtendController *detailImageController = [[ImageViewExtendController alloc] init];
[detailImageController loadImage:url];
[self.navigationController pushViewController:detailImageController animated:YES];
If you set your nav controller's navigationBar to transparent in your App delegate early enough (It worked for me before adding the nav controller to the window), it will automatically shift your view up underneath the navigation bar.
Unfortunately it does not also shift your view underneath the status bar. Sad, it looks like you need to implement your own version of UINavigationController. Luckily, it's not too bad as UINavigationBar is pretty reusable.
Try this:
self.tabBarController.tabBar.superview.backgroundColor = [UIColor blackColor];
Change the Extend Edges options in child viewControllers
As for example, in xcode editor, go to your first viewcontroller child and unset the options:
Extend Edges;
Under Top Bars;
Under Bottom Bars;
Under Opaque Bars;
This way your child ViewController will not layout starting below the status bar of the navigation controller, neither the tabbar or the toolbars
hope it may help anyone