preferredFilenameExtensionForType:
UTIに基づいた優先の拡張子を返します
- (NSString *)preferredFilenameExtensionForType:(NSString *)typeName
func preferredFilenameExtensionForType(_ typeName: String) -> String?
返り値
(NSString *)String?
引数
(NSString *)typeName_ typeName: String
フレームワーク
ApplicationKit
クラス
NSWorkspace
使用可能
10.5-
更新時のバージョン
OS X 10.10.3
Swift1.2
参照
関連記事(外部サイト)
例文
//NSWorkspace preferredFilenameExtensionForType: @IBAction func function019(sender: AnyObject) { //ファイルを選択 var openPanel = NSOpenPanel() openPanel.allowsMultipleSelection = false openPanel.canChooseDirectories = false openPanel.canCreateDirectories = false openPanel.canChooseFiles = true openPanel.beginWithCompletionHandler { (result) -> Void in //オープンパネルでOKを選択したら if result == NSFileHandlingPanelOKButton { //選択したファイルを let theWorkspace : NSWorkspace = NSWorkspace.sharedWorkspace() let theURL : NSURL = openPanel.URL! let filepath : NSString = theURL.path! var anError : NSError? let utiType : NSString? = theWorkspace.typeOfFile(filepath as String, error: &anError) if utiType != nil { NSLog("%@", utiType!) //Ex.->com.apple.web-internet-location , com.compuserve.gif NSLog("%@", theWorkspace.preferredFilenameExtensionForType(utiType! as String)!) //Ex.->webloc , gif } }//if result }//openPanel.beginWithCompletionHandler }
preferredBackingLocation
ウインドウのバッキングストアの優先位置
@property NSWindowBackingLocation preferredBackingLocation
var preferredBackingLocation: NSWindowBackingLocation
解説
ウインドウのバッキングストアの優先位置
フレームワーク
Appkit
クラス
NSWindow
使用可能
10.5
参照
関連記事(外部サイト)
例文
//NSWindow preferredBackingLocation @IBAction func function029(sender: AnyObject) { var aWindow : NSWindow = NSWindow(contentRect: NSMakeRect(0.0, 0.0, 300, 200), styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask, backing: .Buffered, defer: false) windowArray.addObject(aWindow) //ウインドウを保持するための配列に追加。アプリ終了時に配列は破棄 aWindow.center()//ウインドウをスクリーンの中心に aWindow.title = "ウインドウタイトル"//タイトル設定 aWindow.orderFront(self)//前面に aWindow.makeKeyAndOrderFront(self)//表示 switch (aWindow.preferredBackingLocation){ case NSWindowBackingLocation.Default: NSLog("Default") //OSが決定 case .VideoMemory: NSLog("VideoMemory")//ビデオメモリ case .MainMemory: NSLog("MainMemory") //メインメモリ default: NSLog("None") } }
更新時のバージョン
OS X 10.10
backingLocation
保持される場所
@property(readonly) NSWindowBackingLocation backingLocation
var backingLocation: NSWindowBackingLocation { get }
解説
【NSWindowBackingLocation】
●NSWindowBackingLocationDefault
OSによって決定される
●NSWindowBackingLocationVideoMemory
ビデオメモリ
●NSWindowBackingLocationMainMemory
物理メモリ
設定値
読み込みのみです。
Objective-C
@property(readonly) NSWindowBackingLocation backingLocation
var backingLocation: NSWindowBackingLocation { get }
フレームワーク
Appkit
クラス
NSWindow
使用可能
10.5
参照
関連記事(外部サイト)
例文
//NSWindow backingLocation @IBAction func function028(sender: AnyObject) { var aWindow : NSWindow = NSWindow(contentRect: NSMakeRect(0.0, 0.0, 300, 200), styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask, backing: .Buffered, defer: false) windowArray.addObject(aWindow) //ウインドウを保持するための配列に追加。アプリ終了時に配列は破棄 aWindow.center()//ウインドウをスクリーンの中心に aWindow.title = "ウインドウタイトル"//タイトル設定 aWindow.orderFront(self)//前面に aWindow.makeKeyAndOrderFront(self)//表示 switch (aWindow.backingLocation){ case NSWindowBackingLocation.Default: NSLog("Default") //OSが決定 case .VideoMemory: NSLog("VideoMemory")//ビデオメモリ case .MainMemory: NSLog("MainMemory") //メインメモリ default: NSLog("None") } }
更新時のバージョン
OS X 10.10
sharingType
ウインドウのコンテンツに他のプロセスからのアクセス権
@property NSWindowSharingType sharingType
var sharingType: NSWindowSharingType
解説
ウインドウのコンテンツに他のプロセスからのアクセス権
NSWindowSharingType.None
なし
NSWindowSharingType.ReadOnly
読み出しのみ
NSWindowSharingType.ReadWrite
読み書き
設定値
@property NSWindowSharingType sharingType
var sharingType: NSWindowSharingType
フレームワーク
Appkit
クラス
NSWindow
使用可能
10.5
参照
関連記事(外部サイト)
例文
//NSWindow sharingType @IBAction func function026(sender: AnyObject) { var aWindow : NSWindow = NSWindow(contentRect: NSMakeRect(0.0, 0.0, 300, 200), styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask, backing: .Buffered, defer: false) windowArray.addObject(aWindow) //ウインドウを保持するための配列に追加。アプリ終了時に配列は破棄 aWindow.center()//ウインドウをスクリーンの中心に aWindow.title = "ウインドウタイトル"//タイトル設定 aWindow.orderFront(self)//前面に aWindow.makeKeyAndOrderFront(self)//表示 aWindow.canBecomeVisibleWithoutLogin = true switch (aWindow.sharingType){ case NSWindowSharingType.None: NSLog("None") case .ReadOnly: NSLog("readnly") case .ReadWrite: NSLog("read write") default: NSLog("None") } }
更新時のバージョン
OS X 10.10
autorecalculatesContentBorderThicknessForEdge:
境界線の太さを自動計算しているか
- (BOOL)autorecalculatesContentBorderThicknessForEdge:(NSRectEdge)edge
func autorecalculatesContentBorderThicknessForEdge(_ edge: NSRectEdge) -> Bool
解説
ウィンドウが自動的に与えられた境界線の太さを計算しているかどうか。
何をしているのか今ひとつわからない
NSMaxYEdge: トップ
NSMinYEdge: ボトム
フレームワーク
Appkit
クラス
NSWindow
使用可能
10.5
参照
関連記事(外部サイト)
例文
//NSWindow autorecalculatesContentBorderThicknessForEdge //NSWindow setAutorecalculatesContentBorderThickness @IBAction func function016(sender: AnyObject) { var aWindow : NSWindow = NSWindow(contentRect: NSMakeRect(0.0, 0.0, 300.0, 200.0), styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSTexturedBackgroundWindowMask | NSResizableWindowMask, backing: .Buffered, defer: false, screen: NSScreen.mainScreen()) windowArray.addObject(aWindow) //ウインドウを保持するための配列に追加。アプリ終了時に配列は破棄 aWindow.center()//ウインドウをスクリーンの中心に aWindow.title = "ウインドウタイトル"//タイトル設定 aWindow.orderFront(self)//前面に aWindow.makeKeyAndOrderFront(self)//表示 if( aWindow.autorecalculatesContentBorderThicknessForEdge(NSMaxYEdge) ){ NSLog("YES") }else{ NSLog("NO") } var theButton : NSButton = NSButton(frame: NSMakeRect(0.0, 70.0, 300.0, 30.0)) theButton.title = "Change" theButton.bezelStyle = NSBezelStyle.RoundedBezelStyle theButton.action = Selector("buttonAction010:") aWindow.contentView.addSubview(theButton) aWindow.setAutorecalculatesContentBorderThickness(false , forEdge: NSMaxYEdge) aWindow.setAutorecalculatesContentBorderThickness(false , forEdge: NSMinYEdge) aWindow.setContentBorderThickness(0.0 , forEdge: NSMaxYEdge) aWindow.setContentBorderThickness(60.0 , forEdge: NSMinYEdge) }
更新時のバージョン
OS X 10.10
collectionBehavior
ウインドウの動作を指定します
@property NSWindowCollectionBehavior collectionBehavior
var collectionBehavior: NSWindowCollectionBehavior
解説
ウインドウの動作を指定します。
フルスクリーンモードにするときは、この値をセットします。
NSWindowCollectionBehavior.Default
NSWindowCollectionBehavior.CanJoinAllSpaces
NSWindowCollectionBehavior.MoveToActiveSpace
以下のどれか一つを選ぶことが出来ます。指定しない場合はウインドウレベルから自動的に選ばれます。
NSWindowCollectionBehaviorManaged
NSWindowCollectionBehaviorTransient
NSWindowCollectionBehaviorStationary
NSWindowCollectionBehavior.FullScreenPrimary
設定値
@property NSWindowCollectionBehavior collectionBehavior
var collectionBehavior: NSWindowCollectionBehavior
フレームワーク
Appkit
クラス
NSWindow
使用可能
10.0
関連記事(外部サイト)
例文
Swift
フルスクリーンモードにする・戻る
//NSWindow collectionBehavior func buttonAction012(sender: AnyObject){ var theWindow : NSWindow = (sender as NSButton).window! theWindow.toggleFullScreen(self) } @IBAction func function012(sender: AnyObject) { var aWindow : NSWindow = NSWindow(contentRect: NSMakeRect(0.0, 0.0, 300.0, 200.0), styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask, backing: .Buffered, defer: false, screen: NSScreen.mainScreen()) windowArray.addObject(aWindow) //ウインドウを保持するための配列に追加。アプリ終了時に配列は破棄 // var theButton : NSButton = NSButton(frame: NSMakeRect(50.0, 50.0, 100.0, 30.0)) theButton.title = "change" theButton.bezelStyle = NSBezelStyle.RoundedBezelStyle theButton.action = Selector("buttonAction012:") aWindow.contentView.addSubview(theButton) aWindow.collectionBehavior = NSWindowCollectionBehavior.FullScreenPrimary aWindow.orderFront(self)//前面に aWindow.makeKeyAndOrderFront(self)//表示 }
更新時のバージョン
OS X 10.10
timingFunction
INDEX>AppKit> NSAnimationContext
タイミング関数
@property(strong) CAMediaTimingFunction *timingFunction
var timingFunction: CAMediaTimingFunction?
解説
アニメーションのタイミングを計算する関数
フレームワーク
NSAnimationContext
クラス
NSAnimationContext
使用可能
10.5
更新時のバージョン
OS X 10.10
関連記事(外部サイト)
[iOS] Core AnimationのCAMediaTimingFunctionでRobert Pennerのイージングを近似 « きんくまデザイン
iphone - How to create custom easing function with Core Animation? - Stack Overflow
例文
//NSAnimationContext completionHandler //NSAnimationContext currentContext //NSAnimationContext duration //NSAnimationContext timingFunction @IBAction func function003(sender: AnyObject) { var appDelegate = NSApplication.sharedApplication().delegate var window : NSWindow = self.view.window! NSAnimationContext.beginGrouping() var nowPosition : NSPoint = window.frame.origin var newRect : NSRect = didMoveView ? NSMakeRect(nowPosition.x,nowPosition.y, 500.0, 500.0): NSMakeRect(nowPosition.x,nowPosition.y, 500.0, 200.0) window.animator().setFrame(newRect, display: true) window.animator().alphaValue = didMoveView ? 1.0 : 0.5 NSAnimationContext.currentContext().duration = 10.0 var timing : CAMediaTimingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseIn) NSAnimationContext.currentContext().timingFunction = timing NSAnimationContext.currentContext().completionHandler = {NSLog("end!")} NSAnimationContext.endGrouping() didMoveView = !didMoveView }