Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Aug 15, 2012, 11:04 AM   #1
nashyo
macrumors 6502
 
Join Date: Oct 2010
Location: Bristol
A shortcut for ...

Is there a shortcut for ...

Finding out where a method is called

and

Finding out where a property is set

At the moment, I can't find any kind of function that will highlight this useful information for any given method or property I have in my code. Can anyone help?

Thanks
__________________
Xcode 4.5.2, SDK 6.0, OSX Mountain Lion, ARC
nashyo is offline   0 Reply With Quote
Old Aug 15, 2012, 05:09 PM   #2
Ides
macrumors member
 
Join Date: Mar 2012
I don't think there's really an official function in xcode for finding these things. But you could use Edit->Find in Workspace. That will highlight bits of code you're searching for.

Say you want to find out whenever someMethod is being called. You could do a search for "someMethod]", and that should help you locate where it's being called.

To find where a property is being called search for ".propertyName", and to find out where a property is being set search for ".propertyName ="
Ides is offline   0 Reply With Quote
Old Aug 15, 2012, 07:40 PM   #3
Duncan C
macrumors 6502a
 
Duncan C's Avatar
 
Join Date: Jan 2008
Location: Northern Virginia
 
Quote:
Originally Posted by nashyo View Post
Is there a shortcut for ...

Finding out where a method is called

and

Finding out where a property is set

At the moment, I can't find any kind of function that will highlight this useful information for any given method or property I have in my code. Can anyone help?

Thanks
To find where a method is called, use the editor to search all files in your project for the method name (edit menu>find>find in workspace, or command shift F).

To figure out where an instance variable is being changed, there is a facility in the Xcode debugger called watchpoints. They've been broken for a while, but they seem to be fixed again in Xcode 4.4.

To set a watchpoint, stop your program at a breakpoint in the class who's instance variable you want to watch. Then go to the variables view in the debug area, open the disclosure triangle next to "self", and find the variable you want to watch. Right click on it and select the item 'Watch "<variablename>"' in the popup that appears. Watchpoints are listed along with code breakpoints in the breakpoint navigator, and you can enable and disable them as desired.

Once you've set a breakpoint, the next time your code changes that variable, the debugger will stop it and show you the line.
__________________
Regards,
Duncan Champney, WareTo.
Check out our latest iOS app, Face Dancer, available for free on the App Store.
Duncan C is offline   0 Reply With Quote
Old Aug 15, 2012, 07:45 PM   #4
MattInOz
macrumors 68030
 
MattInOz's Avatar
 
Join Date: Jan 2006
Location: Sydney
Also in xCode 4.4 the counterpart editor has the option to show "Callers" of the class you are editing.
__________________
There is no such thing as "Collective Wisdom"
[ iPhone 5s, iPad Mini, 13" MacBookPro 2.7Ghz, 27"Al iMac i7, Black MacBook 13"]
MattInOz is offline   0 Reply With Quote
Old Aug 15, 2012, 08:12 PM   #5
Duncan C
macrumors 6502a
 
Duncan C's Avatar
 
Join Date: Jan 2008
Location: Northern Virginia
 
Quote:
Originally Posted by MattInOz View Post
Also in xCode 4.4 the counterpart editor has the option to show "Callers" of the class you are editing.
Cool. I did not know about that. Is that new in 4.4?
__________________
Regards,
Duncan Champney, WareTo.
Check out our latest iOS app, Face Dancer, available for free on the App Store.
Duncan C is offline   0 Reply With Quote
Old Aug 15, 2012, 08:19 PM   #6
MattInOz
macrumors 68030
 
MattInOz's Avatar
 
Join Date: Jan 2006
Location: Sydney
Yeah, they added a few new counterparts in 4.4.
__________________
There is no such thing as "Collective Wisdom"
[ iPhone 5s, iPad Mini, 13" MacBookPro 2.7Ghz, 27"Al iMac i7, Black MacBook 13"]
MattInOz is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Tags
method, shortcut

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Shortcut to a photo haleymaek iPhone 5 Sep 18, 2013 06:25 AM
No CMD + X shortcut sytrusze Mac Basics and Help 5 Jan 14, 2013 02:44 PM
Pages Shortcut? Anglican-Mac Mac Applications and Mac App Store 0 Dec 15, 2012 02:08 PM
Keyboard shortcut. zaxonus Mac Basics and Help 4 Jul 20, 2012 04:34 AM
Are there any shortcut managers or something? resting OS X 0 Jul 18, 2012 08:56 PM

Forum Jump

All times are GMT -5. The time now is 12:53 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC