Hooking Instance Variables: Difference between revisions

From iPhone Development Wiki
(Created the page)
(No difference)

Revision as of 04:27, 28 March 2015

This page is dedicated to the use of the MSHookIvar function, included in Mobile Substrate, to modify instance variables.


Usage

The code works in the following format:
MSHookIvar<Class*>(varForIvar, "ivar_name")

A number of things need to be noted:

   1. The class can be any sort of class: C class (int, char, etc.), or any other Objective-C Class (CGRect, UILabel*, etc.)
   2. The varForIvar is commonly the variable that contains the instance variable you are hooking
   3. IMPORTANT: the ivar_name is a C String, not an Objective-C String (so no @ sign)