0

I’m new to Cocoa and am trying to create a very simple keynote clone.

For my slides, in the detail view, I use an NSStackView comprised of Textfields set with NSAttributedString. This part works pretty well.

My master section is where I have problems.

I thought I could clone a “slide” View using archive/unarchive, add all the slides to an NSStaxkView and then somehow scale down the sidebar (master) slides.

Problems I have:
1) for the life of me I can’t figure out how to scale the view down to 10% size.
2) I tried using NSBox to create the “card” effect in the sidebar that keynote uses, but am unable to render the view content inside an NSBox for some reason.

Am I going about the architecture all wrong? Any general guidance? I’m currently reading through https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CocoaBindings/Tasks/masterdetail.html

Jamis Charles
  • 5,827
  • 8
  • 32
  • 42
  • My opinion how to do this and I assume Apple do it the same way - Capture an image from the detail view and present it in the sidebar. Capturing should be triggered any time a change in the detail view has be applied. Anything else would be too heavy. Images can be scaled easily. To be able to scale a view you must make it a layer to be able to apply a transform to the layer and sublayers (setAffineTransform, sublayerTransform, ...) – Marc T. Oct 28 '18 at 09:17
  • @MarcT. Perfect! I had definitely not considered turning the view into an image. That worked! Having some issues with text being upside down when an image is included in the view, but I'll figure that out. If you suggest this as an answer with a link similar to this this I'll accept it https://stackoverflow.com/questions/41386423/get-image-from-calayer-or-nsview-swift-3 – Jamis Charles Oct 29 '18 at 17:07

1 Answers1

1

As already mentioned in the comments the best way to mirror the detail view to the side bar is by capturing an image of the detail view to present it in the sidebar. Capturing should be triggered any time a change in the detail view has been applied. There are different possibilities to capture an image of a view and one of them is explained here. Get Image from CALayer or NSView (swift 3)

Marc T.
  • 5,090
  • 1
  • 23
  • 40