Difference between revisions of "Cycript Tricks"

From iPhone Development Wiki
Jump to: navigation, search
(Created page with '=== Printing Ivars === Often just typing *varName works: cy# *controller {isa:"PrefsRootController",_contentView:"<UIView: 0x10bd70; frame = (0 0; 320 460); autoresize = W+H; …')
 
m (Array comprehension. Removing excessively long output.)
Line 1: Line 1:
 
=== Printing Ivars ===
 
=== Printing Ivars ===
Often just typing *varName works:
+
Often just typing <tt>*varName</tt> works:
 
+
<source lang="javascript">
cy# *controller
+
cy# *controller
{isa:"PrefsRootController",_contentView:"<UIView: 0x10bd70; frame = (0 0; 320 460); autoresize = W+H; layer = <CALayer: 0x150120>>",_navBar:"<UINavigationBar: 0x150d40; frame = (0 0; 320 44); autoresize = W; layer = <CALayer: 0x150e00>>",_controllers:["<PrefsListController 0x1525e0: title Settings, view <UIPreferencesTable: 0x1529d0; frame = (0 0; 320 416); clipsToBounds = YES; autoresize = H; layer = <CALayer: 0x152c00>>>"],_title:"Settings",_idStr:"com.apple.preferences.settings",_size:{width:320,height:416},_navBarRightButtonTitle:null,_navBarRightButtonStyle:0,_navBarRightButtonDirty:0,_tasks:"{(\n)}",_deallocating:0,_hasTelephony:1,_togglingAirplaneMode:0,_airplaneMode:"Airplane Mode\t\tID:Airplane Mode 0x15b600",_airplaneSheet:null,_airplaneSheetTarget:null,_airplaneSheetAction:null,_numberOfInstalledApps:61}
+
{isa:"PrefsRootController",_contentView:"<UIView: 0x10bd70; frame = (0 0; 320 460); autoresize = W+H; layer = <CALayer: 0x150120>>",_navBar:...
cy#  
+
cy#  
 
+
</source>
 
+
Sometimes it does not...
Sometimes it doesnt...
+
<source lang="javascript">
cy# *UIApp
+
cy# *UIApp
{message:"hasProperty callback returned true for a property that doesn't exist.",name:"ReferenceError"}
+
{message:"hasProperty callback returned true for a property that doesn't exist.",name:"ReferenceError"}
 
+
</source>
 
then you can do:
 
then you can do:
 
+
<source lang="javascript">
cy# a = []; for (i in *UIApp) a.push(i); a
+
cy# [i for (i in *UIApp)]
["isa","_delegate","_touchMap","_exclusiveTouchWindows","_event","_touchesEvent","_motionEvent","_topLevelNibObjects","_orientation","_networkResourcesCurrentlyLoadingCount","_hideNetworkActivityIndicatorTimer","_editAlertView","_applicationFlags","_controller","_window","_isLocked","_settingTimeZone","_busyControllers"]
+
["isa","_delegate","_touchMap","_exclusiveTouchWindows","_event",...
 +
</source>

Revision as of 12:53, 2 November 2009

Printing Ivars

Often just typing *varName works:

cy# *controller
{isa:"PrefsRootController",_contentView:"<UIView: 0x10bd70; frame = (0 0; 320 460); autoresize = W+H; layer = <CALayer: 0x150120>>",_navBar:...
cy#

Sometimes it does not...

cy# *UIApp
{message:"hasProperty callback returned true for a property that doesn't exist.",name:"ReferenceError"}

then you can do:

cy# [i for (i in *UIApp)]
["isa","_delegate","_touchMap","_exclusiveTouchWindows","_event",...