what is singleton class? Why the whole application creates a single instance?

Answer Posted / babu

A singleton class is a special kind of class where only one instance of the class exists for the entire application. (In the case of an iPhone app, the one instance is shared across the entire app.) Some examples in UIKit are [UIApplication sharedApplication] (which returns the sole instance of the application itself), and [NSFileManager defaultManager] (which returns the file manager instance). Singletons can be an easy way to share data and common methods across your entire app.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Differentiate ‘app id’ from ‘bundle id.’ Explain why they are used?

443


Define encoding or serialization??

449


What are ui elements and some common ways you can add them to your app?

403


When would you say that an app is not in a running state?

606


What is uikit in ios?

476






What widgets can not do ?

520


how push notification works?

465


Procedure to push the app in appstore?

473


What is iphone?

542


Can you explain ios design patterns?

432


What are the viewcontroller lifecycle in ios?

516


What is nspersistentstorecoordinator?

466


What is code signing in iOS operating system?

466


Difference b/w collectionView & uitableview?

1941


Can we save posts to local drafts and figure out how to publish to the blog. What do we need to do?

416