我想知道,如何确切地设定目标C物体。 我已经阅读了不同的博客和pple格,但我只能在这里找到不完整的信息,在那里,关于Ivar和肥胖症的结构,以及各种其他管理方法和结构。
但是,我仍然没有, 当我们称之为“一等”时会发生什么情况,超级数据成员是如何在结构中添加的?
如果可能的话,谁能向我解释这一点,或者向我指出这些实际分配记忆的方法的来源法?
我想知道,如何确切地设定目标C物体。 我已经阅读了不同的博客和pple格,但我只能在这里找到不完整的信息,在那里,关于Ivar和肥胖症的结构,以及各种其他管理方法和结构。
但是,我仍然没有, 当我们称之为“一等”时会发生什么情况,超级数据成员是如何在结构中添加的?
如果可能的话,谁能向我解释这一点,或者向我指出这些实际分配记忆的方法的来源法?
When alloc
is called, it (as any other message send) first gets transformed (by the compiler) into one of the objc_msgSend* functions. This function will get the class structure pointer as its first argument, and @selector(alloc)
as its second.
之后,斜体(sgSend)审视了<条码>+[等级]条码>的相应执行方法,一般而言,这种方法并非压倒一切(在概念上,先入门......),因此,一般而言是+[所有物体]。 一切可能都只是叫+[NSObject alloc 具体如下:
1) It finds the class istance size (probably via class_getInstanceSize())
2) It allocates memory, most likely using the class_createInstance() function. This function clears the allocated memory to zeroes (that s why, as the specs say, all your ivars are explicitly initialized to 0 on startup), then sets the newliy created object s isa
pointer to the class structure itself.
3) The allocWithZone: methods returns the fresh object pointer to alloc
4) alloc returns the object pointer to the sender, most likely it will run into [Class initWith...:]
.
Hope this helps. Also, apart from the Obj-C runtime docs, don t forget to check the GNUstep NSObject implementations. That s a logic and possible way how the GNU people implemented it and how Apple might have implemented it.
http://www.mikeash.com/pyblog/friday-qa-2009-03-13-intro-to-the-objective-c-runtime.html
I ve got the problem when I tried to do asynchronous requests to server from background thread. I ve never got results of those requests. Simple example which shows the problem: @protocol ...
i have a void, like -(void) doSomething in a specific controller. i can call it in this controller via [self doSomething], but i don t know how to call this void from another .m file. I want to call ...
Is there any way to obfuscate Objective-C Code ? Thanks
Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...
I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...
I have a simple Core Data app which displays a list of entities in the main window. To create or add new entities, I use a second modal window with a separate managed object context so changes can be ...
I m trying to show a database information in a tableview and then the detailed information in a view my problem is as follow: I created a NSMutableArray: NSMutableArray *myArray = [[NSMutableArray ...
I am writing an iPhone application which requires the user to enter several values that may contain a decimal point (currency values, percentages etc.). The number of decimal places in the values ...