Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fernandojinzenji/ffaaa9ef831be5f5030d4cef0962db1e to your computer and use it in GitHub Desktop.
Save fernandojinzenji/ffaaa9ef831be5f5030d4cef0962db1e to your computer and use it in GitHub Desktop.
Week 2, Monday - Readings & Questions
Question 1:
A view should not reference directly the controller. Instead, the controller that is responsible to manage which view will be displayed.
Question 2:
a) "Nonatomic" is used for multi threading purposes. If we have set the nonatomic attribute at the time of declaration,
then any other thread wanting access to that object can access it and give results in respect to multi-threading. "Strong"
is a replacement for the retain attribute, as part of Objective-C Automated Reference Counting (ARC). "Weak" is similar
to strong except that it won't increase the reference count by 1. It does not become an owner of that object but just
holds a reference to it. If the object's reference count drops to 0, even though you may still be pointing to it here,
it will be deallocated from memory.
b) Properties encapsulates information of the ivar, making the access possible only through the getter and setter methods.
c) Delegates should be created with the attribute "weak", so it does not hold referente to a class that might already
referente the delegator class (avoiding cross reference).
Question 3:
Through the responder chain, where there is always a first responder that is responsible to handle user interaction.
Question 4:
a) When it is not receiving events, but still in foreground, an app can briefly became inactive.
b) Inside app delegate there are a lot of methods that are triggered when the app becomes active/inactive, enters foreground/background and finishes launching, for example.
Question 5:
-touchesBegan:withEvent: the responder uses the event information provided by UIKit to track changes to those touches and to update the app's interface appropriately.
- pressesBegan:withEvent: tells this object when a physical button is first pressed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment