Skip to content
Vinh Phuc Dinh edited this page May 28, 2014 · 5 revisions

#Next up

  • Create testcases for common UI layouts (UITabBar, UINavigationBar) and more complex layouts with CALayer styles (shadow path, shadow offset, sublayers etc).

  • Shrink PSD, maybe add zip compression

  • Support Landscape mode ✓ Added by @jwalapr

  • Layer names

  • Loading indicator or spinner to present progress

Testcases

The library has only been coded in a pretty short timeframe and only tested on a few apps so far. We desperately need more test cases to check whether the rendering works for different UI layouts.

Shrink PSD

The generated PSD is currently pretty large because each CALayer is rendered directly onto the root window layer. This has the benefit that we can let CoreGraphics handle the hard work of rendering but on the other hand, it also means that each CALayer occupies the size of the entire screen, even if it's just a tiny dot. CGPathGetBoundingBox should do the trick here.

Landscape support

Currently Layershots doesn't do any transformation calculations on the image contexts. This one should be straight forward.

Layer names

The exported layers are currently all named "Layer" and attached to the root of the psd document. Would be way easier to move things around when the CALayer hierarchy would map to the PSD layers/groups, where

  • a layer without sublayers would map to a PSD layer
  • CALayers with sublayers would map to a group and their layer content mapped to the first layer within that group.

Regarding naming of the layers, a scheme as follows might work. Set PSD Layer name to:

  • layer.name if set
  • if layer.name not set, fall back to auto incrementing counter (like "Layer 1.2.1")
    • If layer.delegate is set
      • If layer.delegate is a know class, could do something smart ass lookup. E.g. for UIImage -> "Image", for UILabel, use label.text
      • If delegate class unknown, name PSD layer based on class name (e.g. "ImageView 1.2.1")

Alternatively might also be able to just use the accessibility label or key if available.

Clone this wiki locally