Animating Tab Bar page switching - cocoa-touch

I'm quite confused with the whole animation stuff in iPhone SDK. I tried to study throught the SDK documentation, this website or tried googling it out without success.
I'm unable to get my scenario work.
I have single XIB file, with tab bar and a 4 tabs.
In a special event i want to switch from one page to another "in code", so I call eg: [tabController selectedIndex: 0].
I need this transition to be animated. Is there a way?
If user switches tabs manually, no animated transitions are needed
Also I have one subquestion:
In one of the tabs I have a UITableView with set of items. When user clicks any of these items, another set of items are beign shown (sort of hierarchy browser)
I tried to animate this transition using -deleteRowsAtIndexPaths:withRowAnimation: and -insertRowsAtIndexPaths:withRowAnimation:, but without luck.
Desired transition is shifting the old items set to the left side and the new items from the right side.
This is first time of my iPhone development, when I got lost even with all the forums and documentation. :)
Thanks in advance to anyone trying to help me!

As for your first question: Yes you can.
Try this link for some answer:
transition on tab bar sample code.
In short words: you should add a delegate object to handle the tab bar switching by setting the tabBarController.delegate = self.
Yet, what this forum post won't tell you is that you need to "import" some framework to do it.
First - right-click on the framework folder on the left hand list in Xcode and add an existing framework named: "QuartzCore.framework".
Than - add these lines to your tab bar holder (on .h file):
#import <QuartzCore/CAAnimation.h>
#import <QuartzCore/CAMediaTimingFunction.h>
As for your second question, try to replace the datasource (array or what ever) or create login function on the cell to replace its content.
Enjoy!

First Question: No, you can't animate tab switching. Please read Apple's Human Interface Guidelines on this. Tabs are meant to switch instantly. An animated transition would break the "tab" paradigm.
Second Question: When you tap on a row, the user does not expect other rows to disappear and new ones to appear. Instead, this sounds like a case for a UINavigationController. Please refer to Apple's sample code, specifically the UICatalog for sample code on how to implement this.

Related

Is the order of view controller objects in the navigator pane relevant?

I am just beginning to develop an app using Xcode 5 and am very much a newbie.
I have a project where I want the keyboard to hide after editing a UITextView object. I have compared it to a working project (Apple's Keyboard Accessory example) and the only difference I can see is the order of objects under the View Controller. I can't figure out how to reorder them, but I am not sure if it is a problem. It appears that the wrong object is being selected as First Responder.
I'd appreciate it if someone could tell me if it is relevant and if so how to reorder the objects.
I'm attaching screenshots of both View Controllers. The Water View Controller screen shot is mine and the other one is the Keyboard Accessory example.
In general it does not really matter the order you see them in Document Outline.
You can change the order by dragging them around.
However, sometimes changing the order of 2 items can make some details become invisible, so make sure you always check any changes you make.
Hope it helped

Can't get a RightViewController to work with MEDynamicTransition

I'm trying to modify the TransitionFun example that comes with ECSlidingViewController to include a RightViewController.
I've basically added another ViewController, similar to the existing MenuViewController, that appears on a swipe to the left, (or from extra navigation item on Transition View Controller).
This works fine for the Default transitions but not for the others. Fold and Dynamic transitions jump and behave erratically, while the Zoom transition locks up the app!
(just to clarify - all the transitions initially work fine if I only use the existing left menu view - they only break after transitioning at least once to my new right view).
Has anyone managed to do anything similar? Maybe someone (Mike?) could update the demo to show how its done if possible?
Thanks

XCode: Best Way To Handle A New View In A Tabbed Application

In an iOS Tabbed Application I'm making, I've got tabs to load different viewControllers, which is pretty standard. What I'd like to do is make a few buttons (with images on them) load up another view with the button image maximized to the screen. However, I'm not really sure how to go about doing this. I don't want a new tab for this, I just want another view to show the full image, and then a button to return to the tabbed view. I've experimented a bit with making a subview to do this, and I've attempted to change the main viewport to the new view, with no success. If someone could point me in the right direction, and maybe give me a solid concept as a jumping-off point, I would really appreciate it.
And to clarify, I'm not looking for "the best way", per se. I'd be willing to accept a quick and dirty fix. But if you know of more than one way to handle this situation, I would appreciate whichever one you personally think is better.
I would do it by creating a UINavigationController to use as the primary tab view. When you want to show the full screen button, you create a new UIViewController subclass (below) and push it. That class will return YES for the method "hidesBottomBar" (its something like that).
This new view controller will be a traditional controller. You can create a UIImageView to fill the view (or you can probably replace the view with the imageView). In the viewDidLoad you'll set the UIImage of the view (or you can enter its name in the nib).
When someone clicks on the button, then you'll pop that view and return to your tabbed view (where the tab bar is showing).
I did something like this (not a big button), so I know the tab bar can be made to hide on the push. You can also hide the navigation bar so it never is even show (again, not 100% sure at the moment how to do it but its possible).

Objective-C - What's techniques/objects are being used

On my iPhone, when I go into the Settings app, I see "Airplane Mode", "Wi-Fi", "Notifications", etc. and I'm able to scroll through pages and pages of settings.
I'm new to objective-c and I'm trying to duplicate the functionality in my own app, but I don't know enough about the objects and techniques to know what to ask or what to look for. :)
With that in mind, can someone please explain what's going on with the settings app? What is this using? Is it a UITableView that allows me to scroll down the page? What control is being used to store the text "Airplane" mode? What is happening when I click on the ">" and see a new page?
Any tips are appreciated.
While nobody outside Apple can be 100% sure how they implement their apps, some reasonable guesses would be:
The main screen is a grouped UITableView. Each entry is a single cell.
The text and images in the cells are built using properties of UITableViewCell (e.g. the textLabel UILabel for the text "General"). Some of the more advanced items use custom cell views.
Each category view is another UIViewController, pushed onto the viewControllers stack of a UINavigationController.
The on/off switches are UISliders.
It is a TableView
Table View programming Guide
samplecode
These docs cover all you need

How to create a Controller to simulate the Springboard feature of the iPhone within your own application

I am trying to design a feature in my application for the iPhone that simulates the Springboard feature (Main menu of the iPhone that allows you to view more apps), or the way Weather application works that allows you to flip between views.
Does anyone have any samples of this how I would go about doing this. It's seems very trivial but I am wondering if I am missing something that is already available either as an Apple example or someone who did a tutorial on this.
The image below show how the user would use it.
alt text http://www.agilitesoftware.com/SpringboardExample.png
As they slide their finger to the right (or left) the other image would begin to show up. And it would animate smoothly. The faster you swiped your finger the faster it would move to the next view.
Update: The other feature is that it should mimic the same feel when you slide your hand across the display that is snaps to the current view into place. It should not keep sliding across if there is more than 1 view to the direction you swiping your finger.
I've seen other applications use this so that is why I am asking.
This is accomplished using the UIScrollView with the pagingEnabled property set to true. Just add each of your views, adjust the contentSize, and it will automatically "page" to the width of the screen across the content.
There is a sample app (with code) with exactly this functionality on the iPhone developer site on Apple.com (I believe it's called "PageControl".) - I'd suggest checking it out.
d.
I'm writing an app that uses a similar UI. As NilObject recommended, we're using a UIScrollView with pagingEnabled=YES.
You may also be interested in this example code involving just two child views. I'm trying it out now; it's an interesting technique but I've had to write some additional special-casing code for some odd situations that resulted.
There's also another question on this site that asks about creating a grid of icons like the home screen.
I would check out Joe Hewitt's code from the Three20 project for this. It provides a nice interface and further refinement of the UIScrollView implemented as TTScrollView and TTScrollViewDelegate, TTScrollViewDataSource.