草庐IT

cocoa-touch

全部标签

ios - 如何在 Swift (Xcode 6.3) 中翻转标签(获取镜像 View )

我正在尝试使用CGAffineTransformMakeRotation翻转(获取镜像View)标签文本。但是还是没有进展。这段代码将它垂直翻转,但我无法水平翻转。self.labelShowdata.transform=CGAffineTransformMakeRotation((180.0*CGFloat(M_PI))/180.0)谢谢 最佳答案 试试这个:self.labelShowdata.transform=CGAffineTransformMakeScale(-1,1);swift5:self.table.transfo

ios - 如何在 Swift (Xcode 6.3) 中翻转标签(获取镜像 View )

我正在尝试使用CGAffineTransformMakeRotation翻转(获取镜像View)标签文本。但是还是没有进展。这段代码将它垂直翻转,但我无法水平翻转。self.labelShowdata.transform=CGAffineTransformMakeRotation((180.0*CGFloat(M_PI))/180.0)谢谢 最佳答案 试试这个:self.labelShowdata.transform=CGAffineTransformMakeScale(-1,1);swift5:self.table.transfo

xcode - Interface Builder 的新 IBDesignable 属性是否适用于 NSButton 和 Cocoa 中的其他控件?

我已经设法让IBDesignable/IBInspectable属性与NSView的direct子类一起工作,但不能与的直接子类一起工作NS按钮。这让我怀疑Cocoa的实现是否以某种方式仅限于NSView。Web上的几乎每个示例(以及AppleWWDC2014Xcode视频)都使用NSView,然后将自定义View组件从库中拖到Canvas上(然后更改它的类)。是否可以将IBDesignable与NSControl和NSButton等的子类一起使用...?我在网上看到很多使用UIButton的例子。如果可能,那么您应该从库中将什么拖到Canvas上?它是“自定义View”是没有意义的。

xcode - Interface Builder 的新 IBDesignable 属性是否适用于 NSButton 和 Cocoa 中的其他控件?

我已经设法让IBDesignable/IBInspectable属性与NSView的direct子类一起工作,但不能与的直接子类一起工作NS按钮。这让我怀疑Cocoa的实现是否以某种方式仅限于NSView。Web上的几乎每个示例(以及AppleWWDC2014Xcode视频)都使用NSView,然后将自定义View组件从库中拖到Canvas上(然后更改它的类)。是否可以将IBDesignable与NSControl和NSButton等的子类一起使用...?我在网上看到很多使用UIButton的例子。如果可能,那么您应该从库中将什么拖到Canvas上?它是“自定义View”是没有意义的。

cocoa - 如何在 Swift 中初始化 NSWindowController?

我想从一个nib文件初始化一个窗口Controller对象,很简单吧?但我就是无法让它工作。根据之前ObjC的经验,我写下了如下代码:init(){super.init(windowNibName:"SplitWindowController")}在应用委托(delegate)文件中,我简单地初始化并显示窗口:varmyWindowController:MyWindowController=MyWindowController()myWindowController.showWindow(self)myWindowController.window.makeKeyAndOrderFro

cocoa - 如何在 Swift 中初始化 NSWindowController?

我想从一个nib文件初始化一个窗口Controller对象,很简单吧?但我就是无法让它工作。根据之前ObjC的经验,我写下了如下代码:init(){super.init(windowNibName:"SplitWindowController")}在应用委托(delegate)文件中,我简单地初始化并显示窗口:varmyWindowController:MyWindowController=MyWindowController()myWindowController.showWindow(self)myWindowController.window.makeKeyAndOrderFro

ios - 在 Swift 中结合 CGBitmapInfo 和 CGI​​mageAlphaInfo

我正在将Apple的UIImageEffects示例代码从Objective-C重写为Swift,我对以下行有疑问:vImage_CGImageFormatformat={.bitsPerComponent=8,.bitsPerPixel=32,.colorSpace=NULL,.bitmapInfo=kCGImageAlphaPremultipliedFirst|kCGBitmapByteOrder32Little,.version=0,.decode=NULL,.renderingIntent=kCGRenderingIntentDefault};这是我在Swift中的版本:let

ios - 在 Swift 中结合 CGBitmapInfo 和 CGI​​mageAlphaInfo

我正在将Apple的UIImageEffects示例代码从Objective-C重写为Swift,我对以下行有疑问:vImage_CGImageFormatformat={.bitsPerComponent=8,.bitsPerPixel=32,.colorSpace=NULL,.bitmapInfo=kCGImageAlphaPremultipliedFirst|kCGBitmapByteOrder32Little,.version=0,.decode=NULL,.renderingIntent=kCGRenderingIntentDefault};这是我在Swift中的版本:let

ios - AVAudioPlayer 不在 Swift 中播放音频

我的ViewController中有一个非常简单的单ViewSwift应用程序:varaudioPlayer=AVAudioPlayer()@IBActionfuncplayMyFile(sender:AnyObject){letfileString=NSBundle.mainBundle().pathForResource("audioFile",ofType:"m4a")leturl=NSURL(fileURLWithPath:fileString)varerror:NSError?audioPlayer=AVAudioPlayer(contentsOfURL:url,error:

ios - AVAudioPlayer 不在 Swift 中播放音频

我的ViewController中有一个非常简单的单ViewSwift应用程序:varaudioPlayer=AVAudioPlayer()@IBActionfuncplayMyFile(sender:AnyObject){letfileString=NSBundle.mainBundle().pathForResource("audioFile",ofType:"m4a")leturl=NSURL(fileURLWithPath:fileString)varerror:NSError?audioPlayer=AVAudioPlayer(contentsOfURL:url,error: