I'm trying to find a method thats called once everything has been loaded and displayed. The reason I want to do this is because I have some images that take some time to load in so instead of showing them a black screen I want to show a loading page and then call a setup method.
However the only methods I can find are called before the views come into view...
I am probably being really dumb..
Any help would be great.
Disco
You can use
- (void)viewWillLoad;
and
- (void)viewDidAppear:(BOOL)animated;
to do what you need.
How about
- (void)viewDidAppear:(BOOL)animated;
Related
I would like to add the functionality to change the screen orientation for various views in my app. Having read various tutorials, I implemented the shouldAutorotateToInterfaceOrientation method in each of my view controllers, and got each of them to return yes, as well as log the call to the console, like this:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
NSLog(#"shouldAutorotateToInterfaceOrientation called");
return YES;
}
When I run this on the simulator and change the orientation, I get the log message but nothing on the screen changes. I've tried to find how this could happen but everywhere I've looked says problems are associated with the method not being called, even though it is in my case. Any ideas?
Thanks
I need to know that in your code are you using every views by code or .xib.
Also you need to set autorisizing property for every component...
Solved it: there was a direct UIViewController object being initialised in the code, and changing it to my own simple base class solved the issue. Thanks for the advice!
When I use the TTLauncher to call a TTTableViewController the table is loaded correctly it shows the "Loading..." screen as expected and then the table:
- (void)launcherView:(TTLauncherView*)launcher didSelectItem:(TTLauncherItem*)item {
[[TTNavigator navigator] openURLAction:[TTURLAction actionWithURLPath:item.URL]];
}
However when I call the TTTableViewController from a TTTableSubtitleItem using the URL:
[TTTableSubtitleItem itemWithText:#"Locations Map" subtitle:#"Find a specific location" URL:#"tt://BuildingsLocationTableViewController/Loc"]
the loading screen does NOT show, it waits and then goes directly to the loaded table. Can anyone tell me why these call the TTTableViewController is different ways considering they both map through TTURLMap?
Thanks
JC
The mechanism, as you say, is just the same in both cases.
I would suggest checking your BuildingsLocationTableViewController model definition, and check the isLoadingselector, and the data source titleForLoading selector.
From there, if you debug, you should be able to find out a little more.
I am trying to load a list of assets using the ALAssetsLibrary and enumerateGroupsWithTypes. I populate an NSMutableArrary with the assets loaded so i get to use it later, for instance change a view's background randomly.
I tried to preload this array with the assets in the ViewDidLoad method and only to find out that it gets handled AFTER the view is loaded. if I put a NSLog statement after the load method is called, the log will be printed, but no array initialized until the view is completely loaded.
Question is when should I initialize my array then?
thanks!
The viewDidLoad method does exactly as it suggests - its called once the view is loaded. No surprises there. You could consider loading in the initWithFrame: and/or initWithCoder: methods, depending on which is relevant to you.
Your question doesn't say much about why you want to load something in this method. What's wrong with loading it in, say, the viewDidLoad method and using the array to configure the view before the view will appear? I have no idea how heavy your loading is. But guess what - there's even a handy viewWillAppear: method...!
Ok hopefully this is an easy question:
I have a main viewcontroller that is loaded by the app delegate at application startup.
This viewcontroller has some code in 'viewDidLoad' to create some non view type based objects (some sound/data objects). Aside from that it also loads a UIView.
The sound/data objects take a while to create, but the app is quite functional without them for a start - so I want to load these objects after the UIView has loaded, but can't seem to figure out how.
I have tried moving the appropriate code to viewDidAppear, but this is still called before the UIView actually appears on screen. Is there a function that is called after the viewcontroller actually starts displaying UIViews, or any other way to achieve what I want?
Any help would be much appreciated - thanks!
In case anyone else has a similar problem, I found a way to solve it: use NSThread to load things in the background without pausing everything else.
There's a good simple example here: http://www.iphoneexamples.com/.
I need help getting dataSource in OpenFlow. I
I want to provide CoverFlow functionality whenever the phone is turned horizontally. I'm using Alex Fajkowski's awesome code OpenFlow ( http://fajkowski.com/blog/2009/08/02/openflow-a-coverflow-api-replacement-for-the-iphone/ ) but the example provided is very different than what I need.
I am using OpenFlow in a horizontal view inside a navbar view controller. I have OpenFlow working already. I can scroll through all my images and works really good. However I am using it with over 100 images and it takes a while to load at first. In looking into performance improvements I realized the AFOpenFlowViewDataSource delegate is not getting called. I was able to get AFOpenFlowViewDelegate working by specifying the delegate in the view controller class "flowView.dataSource = self;". But I am not able to get the datasource delegate working. Not even with "flowView.viewDelegate = self;".
Is the datasource needed at all? It seems it is needed for threading of loading.
Ok, it looks like it is running beautiful now. The DataSource delegate is only called when there the objects are loaded dynamically. Meaning, if I use "[(AFOpenFlowView *)self.view setImage]" then dataSOurce is never called because all it knows images are already loaded. However, using "[(AFOpenFlowView *)self.view setNumberOfImages:30];" triggers the DataSource delegate to load the images as they are needed. I found the GetImageOperation NSThread very useful for my 100+ images. However, images are not unloaded after going offscreen. Anyone know how to unload images as they go off screen?