Can I re-purpose a UITabBar button as a normal button? - iphone

What I'd like to do is have 3 or 4 buttons on a UITabBar. All except one of these behave as normal UTabBar buttons - ie they switch between different views. But I'd like one of the tab bar buttons to perform a function - refresh the app's data - without switching views… Is this at all possible?

I suggest you use a tool bar for something like this and simply change the background of the toolbar to make it look similar of that to a tabbar and then add tabbar buttons to the toolbar button.
Although im pretty sure this will be rejected by apple, as the intended purpose for a tabbar is to change views. It has something to do with the apple guidelines about what users expect from certain UI components. and if you start switching around with the main purpose of a UITabBar it will be a confusing place in the apple application world.
PK

Related

Tab Bar with popup buttons iPhone

I want to have this type of bar at the bottom of the application and whenever a button is clicked new buttons should popup, which one of them when clicked should take me to its connected view
You shouldn't use Popup as control, I'll recommend you to use it like a notification as this is not Apple way of showing controls.
Here is a nice link from boctor iDev recipes.
You can find here custom UITabBar as well Notification
I would suggest you not to try customizing UITabbar. This will go against the normal behavior of UITabbar and Apple may reject your app for tampering with normal behavior.
You can try having a UIView with a set of buttons in them and bring the similar functionality as in your image.

Replacing UINavigationControllers NavigationBar with UIView

I am developing app that has multiple skins and I have a dilemma on how to implement this.
One of the solutions would be to have separate nib files for every skin, and load it depending on which skin is currently selected. Problem with this is that I can't edit navigation bar of navigation controller (which my app uses), and I have to change it's background image and back button image etc.. I came up with an idea to hide this navigation bar on every screen and replace it with custom UIView in Interface Builder which will act as navigation bar and custom back button with IBAction for popping current View Controller, so that user won't see any difference.
Is this approach acceptable and if I make it this way, will I have problems with rejection in App Store?
If you choose to hide & replace the UINavigationBar with your own UIView it's no problem as far as Apple goes.
However, I can tell you that you will have to spend some time trying to replicate some visual effects that come naturally with UINavigationBar.
For example, when you push/pop a new controller, you will see that the navigation bar title will slide & fade beautifully. The same applies for left and right bar items.
Personally I would not completely hide the UINavigationBar, but customize it. In the end it all depends on what you want, but by default the UINavigationBar is pretty customizable.
You can add your own buttons or even entire UIViews as left and right bar items. Also, you can add your own UIView as the title (with your own label, custom font or whatever) or change the background.
EDIT:
To easily customize the looks in your entire application, you can subclass UINavigationController and create your own CustomUINavigationController. Then, in viewDidLoad method you can change whatever you want to the navigation bar and this will be accessible in the entire application.
No way, what you are doing is perfect. This will work & no way it will get rejected from app store (just based on this approach). I too have explored several ways to provide skins & what you wrote seemed to be the least hassle-some. Plus its way more easier to create UI elements in Interface Builder hence the separate nib files for different skins.
I am saying this so confidently 'coz I have done the same thing & app store approved.
Best of luck.

How to make a horizontal scrollable UITabBar in iOS?

The UITabBar in my app consists of 10+ items, but the width is enough to put all 10+ items.
How to make a horizontal scrollable UITabBar in iOS ?
Thanks.
You'll have to roll your own to at least some extent.
What might work, would be to create a UITabBar view (not the controller) and embedded it in a UIScrollView. You could then use that in place of your regular Tab Bar control by adding it to your TabBarController.view/tabBarView or something. Of course you'd have to play around to get it to look right, and I'm not sure if just setting the view to something wider will actually make it display more items or not.
Of course, for best results you'd probably want to do something entirely custom.
From Apple's Developer Portal:
If you add more than five items to the viewControllers property, the tab bar controller automatically inserts a special view controller (called the More view controller) to handle the display of the additional items.
Source
Seems like you will need to make a custom tab bar.
They also said this in the next paragraph:
Although the tab bar view is a key part of your tab bar interface, you do not modify that view directly.
You might be breaking Apple's design guidelines by doing this.
You can certainly go and create a custom class of the UITabBar (embedding it into a scrollview etc.)..but why re-invent the wheel? After searching around I found several third-party classes already created that work well and are easy to use and highly customizable..In order of personal preference:
M13InfiniteTabBar -
https://github.com/Marxon13/M13InfiniteTabBar
JSScrollableTabBar -
https://github.com/jasarien/JSScrollableTabBar
InfiniTabBar -
https://github.com/iosdeveloper/InfiniTabBar

Best iPhone app approach for project

I'm building an iPhone app and I'm sort of confused about which approach should I choose for views and controllers.
I would like to have a tabbar at the bottom with three options. I would also like to have a main view displayed when the app shows (along with the tabbar) but I don't want this view to be part of the tabbar options.
So, when the app begins, the tabbar has no option selected but the main view displayed. When a tabbar options is selected, in its top bar it should display a back button to the main view. When the back button is pressed, the main view display again with no tabbar option selected.
Which approach should I choose?
Hope it makes sense.
Thanks.
I understand what you're trying to do, but you shouldn't do that. I don't like that design at all. You should have one navigation controller for each tab.
You should probably read Apple's Human Interface Guidelines as it's possible they would reject your App if they thought such an implementation with a TabBarController was confusing.
As an alternative, you could possibly have the "main view" as you call it accessible with a button in the Navigation bar at the top and then add that to all three tabs. Not necessarily a better design but you probably wouldn't be breaking the guidelines.
A better alternative might be to use a UIToolBar at the bottom instead of the Tab bar which has the three buttons spawning your views modally which can then be dismissed as you suggest.
Remember though, your App's users have built up a knowledge of how App's are generally supposed to navigate, feel and control so you should think carefully before deciding to go against that.
Firstly, I think you should reconsider giving your Main View it's own tab. That way it's a no-brainer for the user to return to that screen. BUT, if you STILL don't like that idea, read on...
The UITabBarController has the unfortunate side effect of not being able to be removed once created (even if you delay it's creation by instantiating it programmatically).
SO...
Option 1: Make your MainView a modalPresentation sub-view, displaying it ON TOP of one of the views in your tab bar (hiding the tabs until you're ready to show them again).
Option 2: Give a subview of your first tab a...
mySubViewController.hidesBottomBarWhenPushed=YES;
This will make the UITabBarController disappear temporarily (just on that view, until you're ready to show the tabs again).
Both options seem kinda messy to me, but they are possible. Depends on how well you execute them, I suppose.
Hope this helps!
You could add the main view as another tab.
OR
You present the main view modally when the app starts over the tab bar views.
The first option would be used more if the view holds the same kind of content as the tabs, for example if the app was an online store, the tabs would be Categories, Search and Recently Added, with what you call the "main view" being the Home page (showing offers or something). (So all the views/tabs would be showing products on the store)
The second option would be more if the content of the main view is different to the tabs.
Keeping with the online store example, if the tabs were Categories, Search and Recently added and what you call the "main view" being a login/logout screen. (so the tabs would be showing products, but the modal view ("main view") being more admin related, and it's main purpose not being to display products.

regarding tab bar controller

I want to show more tahn four tab bar item on tab bar controller by scrolling tab bar . is it possible in iphone if it is.. please give the exact solution.??
Hoping your positive response
The iPhone SDK creates a kind of "favourites" option automatically, so the user can drop their favourite icon to the tabbar..
Maybe you can extend the UITabbar and implement a "scrolling/swiping" mechanism, but I suggest you not to do that. This because swiping on a menu (tabbar) can be really annoying for the end user and they probably drag their "most-use" icons to the tabbar so don't worry about that. My advise: Save your time, and put it into more interesting features for your app instead of spending hours figuring out how to make a scrolling tabbar...
You can also make your own UIView and "duplicate" the tabbar, so it looks like a tabbar but it actually isn't, but again that's a complete different approach...