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

What are the different delete rules that a relationship can have? Which one takes ownership?

621


Is uikit thread safe?

633


What is bundle id?

627


Tell me what is fast enumeration?

633


Ellaborate viper architecture?

635


How to start a selector on a background thread.

594


What are the Common reasons for app rejection from app store review process?

614


Which is the default for synthesized properties?

626


How to set your application id after becoming a member of iphone developer program?

561


How to parse xml?

603


What are layer objects in iOS operating system?

612


Explain @synchronized ,@dynamic

1428


What is category and extension in ios?

579


What does 2x resolution mean?

660


What is dynamic in iOS operating system?

683