Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Sengiri - OS X Application -

Sengiri - OS X Application -

nakajijapan

March 01, 2016
Tweet

More Decks by nakajijapan

Other Decks in Technology

Transcript

  1. iOS

  2. ʁ

  3. Teiten Teiten is an app that fixed-point observation a lot

    earnestly yourself by using a PC camera. http://teiten.nakajijapan.net/
  4. Screen Capture let displayID = CGMainDisplayID() let captureInput = AVCaptureScreenInput(displayID:

    displayID) self.captureSession = AVCaptureSession() self.captureSession.addInput(captureInput) (snip…) self.captureSession.startRunning()
  5. Quartz Display Services Reference • provides direct access to certain

    low- level features in the OS X window server related to the configuration and control of display hardware.
  6. Crop Window backgroundColor = NSColor.clearColor() opaque = false hasShadow =

    false self.styleMask = NSBorderlessWindowMask | NSResizableWindowMask
  7. NSWindow.h /* NSWindow.h Application Kit Copyright (c) 1994-2015, Apple Inc.

    All rights reserved. */ public var NSBorderlessWindowMask: Int { get } public var NSTitledWindowMask: Int { get } public var NSClosableWindowMask: Int { get } public var NSMiniaturizableWindowMask: Int { get } public var NSResizableWindowMask: Int { get }
  8. NSWindowController • manages a window, usually a window stored in

    a nib file. • Loading and displaying the window • Closing the window when appropriate • Customizing the window’s title • Storing the window’s frame (size and location) in the defaults database • Cascading the window in relation to other document windows of the application
  9. NSViewController • Added OS X 10.5 • Prior to OS

    X 10.10 • View Controllers were not part of the responder chain. • View life cycle methods such as viewDidLoad(), viewWillAppear() • Cocoa did not provide any container view controllers • NSWindow’s contentViewController was not available • OS X 10.10 Yosemite Release Notes Cocoa Application Framework • Almost the same feature UIViewController for iOS • Storyboards • Container
  10. Quartz Window Services Reference let windowInfosRef = CGWindowListCopyWindowInfo( [CGWindowListOption.OptionOnScreenOnly, CGWindowListOption.OptionOnScreenBelowWindow],

    windowID ) var items = [Dictionary<NSObject, AnyObject>]() for i in 0..<CFArrayGetCount(windowInfosRef) { let lineUnsafePointer:UnsafePointer<Void> = CFArrayGetValueAtIndex(windowInfosRef, i) let lineRef = unsafeBitCast(lineUnsafePointer, CFDictionaryRef.self) let dictionary = lineRef as Dictionary<NSObject, AnyObject> print((dictionary[kCGWindowLayer as String] as! NSNumber).integerValue) items.append(dictionary) }
  11. Quartz Window Services Reference var topWindow:Dictionary<NSObject, AnyObject> let items =

    self.windowListAboveWindowID(CGWindowID(0)) for i in 0..<items.count { if items[i].isNormalWindow() { let item = items[i] topWindow = item break } } TFMGMBZFS$(8JOEPX-FWFM'PS,FZ /PSNBM8JOEPX-FWFM,FZ