In my app, I have noticed that it will run slowly for the first few seconds of running because objects are still being initialized, drawn to the screen, etc. How do I load these objects and create a bar to show the progress of the loading?
Share
You can show a loading screen.
You can use different threads and detach threads.
Alternatively you can use a
UIActivityIndicatorVieworUIProgressBarto show that currently loading is on.UIActivityIndicatorViewbasically is like when you start up your mac. A spinning circle.UIProgressBaris a empty bar that fills up with blue as the loading increases.A
UIProgressBarhas a variable calledprogresswhile you just sendstartAnimatingandstopAnimatingmessages to aUIActivityIndicatorTo read more about these two, check the links below:
Progress Bar Apple Documentation
Progress Bar Image
Activity Indicator Apple Documentation
Activity Indicator GIF Image
UPDATE TO YOUR QUESTION ON OTHER ANSWER:
What are you loading for? Does the class/object you are loading for have a delegate method? If you are saying
Considering
objectbelow is one of your objectsYou could say
Also to check if DRAWN to the screen try:
or
or the method
Return Value
YESif the receiver is an immediate or distant subview of view or if view is the receiver itself; otherwiseNO.ALSO: when i say
self.view, it doesn’t have to beself, since loading view might be a different view. You could make an object to that other class and call that class instead ofself. Like:if([otherClass.object superview] == otherClass.view)
You could also make an
updatemethod in the other class so you could say:and then have this as the
updatemethod:This is a lot to take in! Any other questions?