[課堂筆記]斯坦福大學公開課:IOS 7應用開發 lecture1

來源:互聯網
上載者:User

標籤:

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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.