码迷,mamicode.com
首页 > 移动开发 > 详细

[课堂笔记]斯坦福大学公开课:IOS 7应用开发 lecture1

时间:2016-05-14 18:43:44      阅读:239      评论:0      收藏:0      [点我收藏+]

标签:

1.The difference is card.h is the public API.That’s what your dot h is.It’s your public API.It’s what methods in your class you want to make public so that other people can call them.Card.m is your private API and all your implementation.
 
2.It’s important to understand that in objective-C all objects,all of them live in the heap and we have pointers to them.There’s no such thing as making an object on the stack or anything like that.They are all in the heap.Heap is just where you allocate free memory.(lesson1 38:00)
 
3.All pointer properties have to be strong or weak because the objective-C has to know what to do with the memory and the heap.Strong means keep the memory for the thing this points to,in the heap,as long as I or anyone else has a strong pointer to it.So this is called reference counting.It’s not garbage collection,it’s reference counting.So objective-C is going to keep track of every single strong pointer to an object in the heap,and as long as at least one strong pointer exists,it’s going to keep that in heap.As soon as there are no strong pointers left,it will free the memory out of the heap,instantly.Not garbage collected later,but actually instantly,reclaim that memory.(lesson1 39:00)
 
4.If you have a weak pointer,that tells objective-C,okay,I have a pointer to this thing in the heap and keep it in memory as long as someone else has a strong pointer to it.But as soon as no one else has a strong pointer to that thing,it gets freed from memory.And this pointer,if it was weak,gets set to nil.And remember weak no only cleans it up,but it sets your pointer to nil.(lesson1 40:00)
 
5.Nonatomic means calling this setter and getter that go along with this property is not thread safe.So you can’t have two threads trying to set this property at the same time. (lesson1 42:00)
 
6.When you type the @property on the .h,this gets added to your @implementation.And not only that,they’re public,because you put that at @preoerty declaration in your header file.(lesson1 46:00)
 
7.These properties(BOOL) don’t need the strong or weak.Because they’re primitive types,they’re not stored in the heap.(lesson1 47:00)
 
8.We did not say card.contents equals equals self.contents.Because we’d just be comparing the pointers then,not what the pointers point to.(lesson1 54:00)

[课堂笔记]斯坦福大学公开课:IOS 7应用开发 lecture1

标签:

原文地址:http://www.cnblogs.com/superorangecc/p/5492991.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!