一个在应用程序内运行的 iOS 监视器,让您可以在真实环境中从设备上进行调试和分析。
Developer tools for iOS. Runs on the device, no browser or computer needed.
(think Firebug or Webkit Developer Tools)
gem install motion-xrayUIWindow with Motion::Xray::XrayWindowAnd if you want the email features, add `app.frameworks editor class } } end end
If you inherit from a view and you want to *disable* one of the editors, assign
`nil` as the editor for that property. `UIWindow` does this to prevent editing
`frame`, `hidden`, and `userInteractionEnabled` properties from getting changed.
```ruby
class {
frame: nil,
hidden: nil,
userInteractionEnabled: nil,
},
}
end
end
…
ruby
Motion::Xray.registerPlugin(Motion::Xray::SaveUIPlugin.new) # use teacup
Motion::Xray.registerPlugin(Motion::Xray::SaveUIPlugin.new(:pixate))Register custom output, by class. This will be used for any property, for
instance if you want UIColor objects to be persisted as an array of RGB
values, you could register that output like this:
register(:teacup, UIColor) { |color| "[#{color.red}, #{color.blue}, #{color.green}]" }…ruby Log = Motion::Xray::Log
Log.info('info!') Log.error('an error occurred!')
Log.level = Log::Warning
…ruby class AccessibilityPlugin < Plugin name 'Accessibility' # as you want it to appear in the toolbar
addSubview on this object.def plugin_view(canvas) return UIView.initWithFrame(canvas.bounds) end
end
So far we have:
- named our plugin 'Accessibility'
- returned an empty container
Let's add our two image views. We'll make use of geomotion, which is required
by Xray:
```ruby
def plugin_view(canvas)
return UIView.alloc.initWithFrame(canvas.bounds).tap do |view|
view.backgroundColor = :black.uicolor
@accessibility = UIButton.alloc.initWithFrame(view.bounds
.thinner(view.bounds.width / 2))
@colorblind = UIButton.alloc.initWithFrame(view.bounds
.thinner(view.bounds.width / 2)
.right(view.bounds.width / 2))
view << @accessibility
view << @colorblind
end
endWhen the plugin is activated, we should grab a screenshot of the app and assign
it to each view. The show method is called on a plugin when it is selected.
def show
Dispatch::Queue.main.async do
@colorblind.setImage(get_colorblind_image, forState: :normal.uicontrolstate)
end
Dispatch::Queue.main.async do
@accessibility.setImage(get_accessibility_image, forState: :normal.uicontrolstate)
end
end
…
ruby
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = Motion::Xray::XrayWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
@window.makeKeyAndVisible
# include the SaveUIPlugin, which is not included by default
Motion::Xray.register(Motion::Xray::SaveUIPlugin.new)
# include a custom plugin
Motion::Xray.register(CustomPlugin.new)
return true
end
endXray depends on geomotion, which I don't feel bad about, and SugarCube. I would
consider removing the SugarCube dependency, because not everyone uses it, but
SugarCube adds a ton of benefit (like #to_s and UIColor additions).
暂无开放 Issues,或尚未同步最近议题。