¡@

Home 

2014/10/15 ¤U¤È 10:08:11

iphone Programming Glossary: encapsulation

Internal properties versus ivars

http://stackoverflow.com/questions/10469488/internal-properties-versus-ivars

the value of properties. It all comes down to this in a property you have encapsulated the use of a variable. That encapsulation is invaluable when needed and not much overhead when it is not. For example off of the top of my head Suppose you discovered..

When should I initialize a view controller using initWithNibName?

http://stackoverflow.com/questions/2224077/when-should-i-initialize-a-view-controller-using-initwithnibname

It puts implementation details the name of the NIB and the fact that a NIB is even used into the caller. That breaks encapsulation. The correct way to do this is MYViewController vc MYViewController alloc init Then in MYViewController id init self super.. nil This moves the key implementation details back into the object and prevents callers from accidentally breaking encapsulation. Now if you change the name of the NIB or move to programmatic construction you fix it in one place in the view controller..

SOAP, REST or just XML for Objective-C/iPhone vs. server solution

http://stackoverflow.com/questions/2473080/soap-rest-or-just-xml-for-objective-c-iphone-vs-server-solution

Declaring private member variables

http://stackoverflow.com/questions/3571539/declaring-private-member-variables

member variables I've started learning Objective C a few weeks ago and I still don't understand how to manage the encapsulation of a class correctly. What is the best way to declare a private member variable in a class It seems that setting the right.. guetter setter by not declaring a property. Am i right Or is there a better way Thanks iphone objective c properties encapsulation private members share improve this question if you don't want it accessible to other classes declare the @property on..

Compiler gives warning on performSelectorOnMainThread:@selector(delegateMethod)

http://stackoverflow.com/questions/4499343/compiler-gives-warning-on-performselectoronmainthreadselectordelegatemethod

to the type of my parent object inside the selector but that is just plain crazy and goes against the delegate encapsulation pattern. I would really appreciate a third solution from someone with a better understanding of the language Thank you in..

Repeating NSTimer, weak reference, owning reference or iVar?

http://stackoverflow.com/questions/4945028/repeating-nstimer-weak-reference-owning-reference-or-ivar

the timer they accessed and provide your own setter. Rescheduling a timer is in my opinion not a good reason to break encapsulation here provide a mutator if you need to do that. Set the timer up with a target other than self. There are plenty of ways..