iphone: "preload" a view (tab bar controller) - iphone

Basically my app loads two RSS feeds - a blog feed and a twitter stream. These are in two different views in a tab bar controller. There is also a Home view which is the default view when the application launches.
Ok, so basically when you go from the Home tab to the blog or twitter tab then it takes a while to load. Fair enough, its trying to download everything off the internet.
My question is, while the user is on the home page is there any way of "preloading" the other views so that the viewDidAppear function is already run?
Or, maybe a way of having a "loading" screen, because at the moment it seems like the application has just crashed when you click on a tab, the tab doesn't even highlight until it has loaded the view.
Thanks a lot guys.

IMO it's not a good idea to preload the views themselves. But it might make sense to preload the data from the home screen (at least when you're connected to WiFi). To do that, decouple the loading code from the view, e.g. by moving it to a separate model class.
In general, you should implement all your network connections asynchronously to avoid freezing the UI during these operations.

Related

Refreshing the webview in iPhone app

In the home page of my iphone application i am calling a web page, users can do some actions(comment,like etc) from other tabs of my app-After that,when the come back to home page the web page must be refreshed(eg:- comment/like count must be incresed)
If user do the refreshing of home page(scroll up from top) the page is getting refreshed,but the client wanted to refresh it automatically
So i have loaded the web page in viewDidAppear method,
Now problem is-whenever user come back to home page it gets refreshed and showing from the top(if user go to detail from some link at bottom and come back,webpage shows the top)
how to prevent this,or is there any better idea for automatic refreshing ?
Perhaps a better way would be to use javascript to download the updates in the background, then update your content appropriately. UIWebView has a method –stringByEvaluatingJavaScriptFromString: which can be used to run javascript code. You could supply the method call to perform the refresh in your -viewDidLoad method.
Another option could be to download the HTML in the background, and compare it too what is displayed, if different, swap. That way content is only refreshed when needed. Although that still gives you the problem of content moving to the top.

What is the best way to manage 9-15 view from a main menu in an iOS app?

In my iPhone app, I must have around 9-15 different views, all available from a main menu. I started yesterday with a simple tab bar controllers, but they are only ideal with 6-7 views. Which controller can I use? Is there a nice one for my needs?
Edit: I am talking about around 9-15 menu-points for my application.
Each point is a single, categorizable function. I though about something like the Facebook app, where the app shows 2 menu-pages (slideable) and 9 icons on each page, each with another view / function in it.
look for cocoacontrols.com . i think you will find your need there .....
I think the component you are looking for(the same used in facebook app) is in the three20 library. Its called Launcher. It's like having iphone springboard inside the app. I'd go with that.
Can your views be split into categories? If so, I would suggest using the tab bar tabs as categories, and then using a table view as a menu in each tab.
You could also try using a page control, but 9-15 views seems like they would be obnoxious to navigate with a page control.
I understand that you need to have access to those "views" all the time. You can do what an iphone CNN app does. It uses horizontal scroll, where it has lot's of "views".
This is propably the most challenging part of writing an app for mobile phones. At least i find it not that easy to find the perfect user interface. Espcially if you have so much content and navigation to show.
I think the best way to solve this problem is to write your own navigation. If you want to use something similar like the facebook app - this is not so hard.
Take a UIScrollView in combination with the UIPagingControl. Create a new View for your buttons or whatever you want your user to see and put it in the scroll view. Enable paging for the UIScrollVIew and your almost done. Maybe it's not the easiest way - but in the end it's the most flexible way. You can decide what you want to show and you dont have to be dependent on what some other developer wrote.
Just a thought :)
// Edit: Just read in another question about appLauncher. This might be such a control you are looking for.
https://github.com/rigoneri/myLauncher

Double title bar issue iPhone app

I have noticed that whenever a phone call comes in while my app is in use (Or I simulate in-call status bar using the simulator), and the phone call ends, I end up with a double status bar in my app. The status bar goes away if I click any other tab and come back to the original tab (my app has a UITTabBar in it).
I have tried so many options that I am losing track now. The most I have read are to set your UIView's size to be flexible in interface builder but nothing seems to work.
Please look at the screenshots. I am pasting a default view of the sizing options in interface builder but believe me I have tried every single configuration option there.
Do you have some heavy compute-bound processing taking place on the main thread? The main thread should be dedicated to UI updates, with non-UI stuff kicked off onto separate threads.

App design: UITabBarController within UINavigationController

I have a very specific application design that I'm trying to figure out how to create with iOS 4.
Here's how it works:
The user selects an installed data set, or triggers a data set download.
The user provides a key for decrypting the data set.
A tab bar is shown with different search options for looking at the data. There are more searches than fit on the tab bar, so there's a More item and an Edit button. (Thanks, Apple!)
The searches provide different options, some requiring an additional screen for setup.
Once a search result is tapped, the user sees details. They can usually tap deeper into the result.
The tab bar stays visible as users look at details, letting them start a different kind of search. Tapping a search takes them back to step 3.
If at any time the device goes to sleep, the data must be locked. This is a hard requirement, despite may efforts to remove it. So at the moment, I'm returning to step 2.
I've implemented this in iPhone OS 3.1 with a UINavigationController for steps 1 and 2. The app pushes a UITabBarController with each tab represented by a UINavigationController for step 3, hiding the navigation on the outer controller. The user then operates within this UITabBarController. For a lock, I just pop the tab controller off the navigation controller.
It mostly works in iPhone OS 3.1, but it's fragile and hackish. There was no good way to change the data set, but the user could just close the app. With iOS 4 this workaround is gone! The only option I see is returning to step 2 on a supsend/resume, which is going to be a terrible multitasking experience.
How should I be doing this?
The tabs don't make sense until the data set is opened and unlocked.
I (and my users) really like the single tap (no matter the depth) to start a new search.

how to create multiple pages in Xcode iphone apps

i am starting my experience with iphone sdk. and i have a question, which is i am trying to create two pages to the app but i don't know how to link them or design them. like when i start the Xcode i find one page named View to design in it, i want to make that page a welcoming page then the user choose one of the three choices he see in that page. Once he clicked on one of them the program take him to the next page or the page he chose.
thank you
The standard approach on iPhone is a drill-down. Place a UINavigationController in your NIB, make the root-level view your welcome page. Then navigate to dependent views by invoking pushViewController on that navigation controller.
This is a very high-level description; you'd have to fill a lot of blanks. If you create a new project and specify a "navigation-based application", you'll get quite a bit of boilerplate code for this approach.
You really need a good book, I recommend Beginning iPhone 3 Development by Apress.
Take a look at using UIViewController's
- (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated
method. You can display your initial view, and when the user presses one of the buttons, display the intended view over top. If you build a new project, and choose "Utility Application" you will get some sample code for how this works.