ios - Is the object passed in prepare a singelton ?What's the different? -
i notice object pass between 2 view controllers has same address in 2 controllers. , if change value in controller b, value of object in controller changed automatically. inspire me consider object singelton..for singelton design pattern, advantage using global valuable saving system resource , keep consistency of object.what thinking right? there difference?
- an object passed between 2 view controller can same object if use strong property.it can 2 different objects if use copy property.
- if use singleton.it same instance of 1 class.when using singleton,you should manage life circle of it.
it design.
when using object pass between viewcontrollers,only 2 viewcontrollers can access object.
but,when using singleton,every place of application can access instance.
Comments
Post a Comment