Tag: 快速

获取错误,错误:npm安装后找不到模块“express”

我是新的两个节点的JS和expression,我刚刚在Windows 7中安装npm。 我使用全球标志安装了快递: npm install -g express 在C:\Users\USER_NAME\AppData\Roaming\npm\node_modules\express成功安装了Express,并将C:\Users\USER_NAME\AppData\Roaming\npm到我的path中。 但是,在命令行中使用express并不成功。 任何以express开头的命令都会告诉我它找不到要执行的命令: 'express' is not recognized as an internal or external command, operable program or batch file. 查看安装文件夹,找不到可执行文件(.exe或.cmd)。 通过search过去的问题显示,node_modules文件夹(至less在过去的版本中)应该同时包含express文件夹(我有)和.bin文件夹,其中包含express.cmd 。 我似乎没有.bin文件夹。 npm –version给我1.4.3 。 Express版本看起来是3.0.0 我也尝试在本地安装它,我已经尝试运行npm cache clean并重新安装。 这两种方法都不会改变情况:node_modules文件夹中没有可执行文件。 我是否正确安装快递? 如果是这样,为什么不包含可执行文件?

如何在Swift中拆分string

let string = "hello hi" var hello = "" var hi = "" 我不想分割我的string,以便你好的价值“你好”和嗨的价值“嗨”

我怎样才能添加速度button与链接的链接?

首先,在提交我的应用程序之前,我不知道如何获取链接,并且链接是针对每个国家的app store还是通用的? 此外,我不知道是否只是把链接放在那里: @IBAction func rate(sender: AnyObject) { UIApplication.sharedApplication().openURL(NSURL(string : "webLinkHere")!) } 或者我应该用另一种方式来做到这一点? 谢谢

具有阴影,圆angular和自定义drawRect的UIView

我必须创build一个自定义UIView ,将有圆angular,边框,阴影和其drawRect()方法被覆盖,以提供自定义的绘图代码与几个直线绘制到视图(我需要使用一个快速,轻量级因为许多这些视图可能会呈现)。 我目前面临的问题是,只要在视图类中重写drawRect() (即使没有任何自定义代码drawRect() ,阴影也不适用于圆angular。 请参阅附加图像的差异: 在视图控制器中我使用下面的代码: view.layer.cornerRadius = 10; view.layer.masksToBounds = true; view.layer.borderColor = UIColor.grayColor().CGColor; view.layer.borderWidth = 0.5; view.layer.contentsScale = UIScreen.mainScreen().scale; view.layer.shadowColor = UIColor.blackColor().CGColor; view.layer.shadowOffset = CGSizeZero; view.layer.shadowRadius = 5.0; view.layer.shadowOpacity = 0.5; view.layer.masksToBounds = false; view.clipsToBounds = false; 在重写的drawContext()我会使用类似于: var context:CGContext = UIGraphicsGetCurrentContext(); CGContextSetStrokeColorWithColor(context, UIColor.redColor().CGColor); // Draw them with a 2.0 stroke width […]

Swift – angular落半径和阴影的问题

我试图创build一个圆angular和阴影的button。 无论我如何切换,该button将无法正确显示。 我试过masksToBounds = false和masksToBounds = true ,但是无论是angular落半径的作品和阴影不或阴影的作品和angular落半径不剪辑button的angular落。 import UIKit import QuartzCore @IBDesignable class Button : UIButton { @IBInspectable var masksToBounds: Bool = false {didSet{updateLayerProperties()}} @IBInspectable var cornerRadius : CGFloat = 0 {didSet{updateLayerProperties()}} @IBInspectable var borderWidth : CGFloat = 0 {didSet{updateLayerProperties()}} @IBInspectable var borderColor : UIColor = UIColor.clearColor() {didSet{updateLayerProperties()}} @IBInspectable var shadowColor : UIColor = […]

在swift中比较数组

试图了解如何迅速比较数组。 var myArray1 : [String] = ["1","2","3","4","5"] var myArray2 : [String] = ["1","2","3","4","5"] // 1) Comparing 2 simple arrays if(myArray1 == myArray2) { println("Equality") } else { println("Equality no") } // -> prints equality -> thanks god // 2) comparing to a "copy" of an array // swift copies arrays when passed as parameters (as […]

在Swift中以编程方式更新约束的常量属性?

我想animation一个对象,所以我声明一个约束,并将其添加到视图。 然后更新UIViewanimation中的约束的constant属性。 为什么这个代码不移动对象? UIView.animateWithDuration(1, animations: { myConstraint.constant = 0 self.view.updateConstraints(myConstraint) })

Swift – 获取设备的IP地址

我需要在Swift中获取iOS设备的IP地址。 这不是关于这个问题的其他问题的重复! 我只需要获得WiFi的IP地址,如果没有wifi的IP地址 – 我需要处理它。 关于堆栈溢出有几个问题,但只有返回IP地址的函数。 例如(从如何获得IP地址在迅速 ): func getIFAddresses() -> [String] { var addresses = [String]() // Get list of all interfaces on the local machine: var ifaddr : UnsafeMutablePointer<ifaddrs> = nil if getifaddrs(&ifaddr) == 0 { // For each interface … for (var ptr = ifaddr; ptr != nil; ptr = ptr.memory.ifa_next) { […]

在Swift中获取设备方向

我想知道如何在Swift中获得当前的设备定位? 我知道有Objective-C的例子,但是我还没有能够在Swift中工作。 我正在尝试获取设备方向并将其放入if语句中。 这是我遇到的最多问题: [[UIApplication sharedApplication] statusBarOrientation]

如何在swift(iOS)中创build单选button和checkbox?

我正在开发一个允许进行调查的应用程序。 我的布局是从基于XML的问题生成的。 我需要创build单选button(单选)和checkbox(多个答案)。 我没有发现任何有用的迅速。 有没有人有一个想法?