小编Esq*_*uth的帖子

iBeacon在Android上运行吗?

我可以将我的iBeacon发送推送通知到Android设备吗?如果是这样,Android版本和设备限制是什么?

(我在这里问的原因是因为在快速谷歌搜索中仍然不容易找到这个问题.)

android ibeacon

1
推荐指数
1
解决办法
4701
查看次数

获取indexPath.row的字符串值

这两种方法之间的区别是什么来获取indexPath.row的字符串值?

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    var newString: String = String(indexPath.row)
    var newString2: String = indexPath.row.description)
}
Run Code Online (Sandbox Code Playgroud)

uitableview ios swift

1
推荐指数
1
解决办法
4941
查看次数

UIView frame.size.width与frame.width之间的区别

var view = UIView(frame: CGRect(x: 5, y: 5, width:50, height: 30))
println(view.frame.size.width)
println(view.frame.width)
Run Code Online (Sandbox Code Playgroud)

他们都打印出相同的值,这两者之间的区别是什么?是否存在应该使用特定场景的特定场景?

frame uiview

1
推荐指数
1
解决办法
1129
查看次数

需要导入 UIKit 的新项目文件

我有一个项目 A,我开始使用 Swift1-Xcode6 编写它。我有一些扩展文件,例如:

extension UIView {
    convenience init(x: CGFloat, y: CGFloat, w: CGFloat, h: CGFloat) {
        self.init(frame: CGRect(x: x, y: y, width: w, height: h))
    }
}
Run Code Online (Sandbox Code Playgroud)

我创建了一个新项目 B 并将这些扩展文件复制到那里。我收到此错误:

UIViewExtensions.swift:11:11: Use of undeclared type 'UIView'
Run Code Online (Sandbox Code Playgroud)

Project-A 中的文件不需要包含 UIKit,但 Project-B 需要。是什么原因?

frameworks uikit swift xcode6

1
推荐指数
1
解决办法
1163
查看次数

如何在Swift 2.2中为语句编写复杂的C风格

如何for在Swift 2.2中实现这样的C风格循环?

for var level: Double = 10; level <= 100; level += 10 {

}
Run Code Online (Sandbox Code Playgroud)

ios swift swift2 ezswiftextensions

1
推荐指数
1
解决办法
129
查看次数

0
推荐指数
1
解决办法
310
查看次数

字典打印结果向后

在视频教程中:

快速无脚本教程介绍苹果Swift progrqmming语言在16分钟内 http://youtu.be/3tZig9AWMdc?t=9m10s

我和他做了同样的事情,但后来得到了结果

var names = [
    "1" : "...",
    "2" : "...2"
]

for (k,v) in names {
    println("key is \(k) : value is: \(v)")
}
Run Code Online (Sandbox Code Playgroud)

输出:

Hello, World!
key is 2 : value is: ...2
key is 1 : value is: ...
Run Code Online (Sandbox Code Playgroud)

我在这里错过了什么?

dictionary swift

0
推荐指数
1
解决办法
646
查看次数

Swift 类型推断如何影响编译和运行时?

var number = 3
Run Code Online (Sandbox Code Playgroud)

对比

var number: Int = 3
Run Code Online (Sandbox Code Playgroud)

使用特定类型与类型推断如何影响编译时间?有没有人做过这个主题的实验或一些数学运算?

这个运行时到底有没有影响?

performance compiler-optimization swift

0
推荐指数
1
解决办法
285
查看次数

在我的函数中没有调用异步Mocha done()

我调用此函数,调用控制台日志但未调用done():

import {Database} from "../../code/server/Database";
import 'mocha'
const expect = require('chai').expect

describe('Database save', function() {
    it('should save without error', function(done) {
        Database.saveSessionData(1, 2, 3, function(err, docs) {
            expect(err).to.equal(null)
            expect(docs.sessionOpenTime).to.equal(1)
            expect(docs.sessionCloseTime).to.equal(2)
            expect(docs.sessionLength).to.equal(3)
            console.log(2222)
            done()
        })
    })
})
Run Code Online (Sandbox Code Playgroud)

结果是,"运行测试"将继续持续进行:

结果

但是,如果我将"数据库"代码更改为此代码,它将按预期工作:

setTimeout(function () {
            console.log('lol')
            done()
        }, 1000)
Run Code Online (Sandbox Code Playgroud)

我在这里错过了什么?

javascript mocha.js webstorm chai typescript

0
推荐指数
1
解决办法
316
查看次数

用于面部检测的kCGImagePropertyOrientation是什么?

https://developer.apple.com/library/ios/documentation/graphicsimaging/Conceptual/CoreImaging/ci_detect_faces/ci_detect_faces.html

@清单2-1创建面部检测器

CIContext *context = [CIContext contextWithOptions:nil];                    // 1
NSDictionary *opts = @{ CIDetectorAccuracy : CIDetectorAccuracyHigh };      // 2
CIDetector *detector = [CIDetector detectorOfType:CIDetectorTypeFace
                                      context:context
                                      options:opts];                    // 3

opts = @{ CIDetectorImageOrientation :
      [[myImage properties] valueForKey:kCGImagePropertyOrientation] }; // 4
NSArray *features = [detector featuresInImage:myImage options:opts];        // 5
Run Code Online (Sandbox Code Playgroud)

4.设置选项字典以查找面孔.让Core Image了解图像方向非常重要,这样探测器就能知道它可以在哪里找到直立面.大多数情况下,您将从图像本身读取图像方向,然后将该值提供给选项字典.

Use of undeclared identifier 'kCGImagePropertyOrientation'
Run Code Online (Sandbox Code Playgroud)

这个图像道具定位应该是什么?
什么样的对象?
我该如何设置?

objective-c face-detection ios ciimage

-2
推荐指数
1
解决办法
4273
查看次数

类func与仅func之间的区别

这两个有什么区别?

extension UIFont {
    class func PrintFontFamily(font: FontName) {
        let arr = UIFont.fontNamesForFamilyName(font.rawValue)
        for name in arr {
            println(name)
        }
    }
}

extension UIFont {
    func PrintFontFamily(font: FontName) {
        let arr = UIFont.fontNamesForFamilyName(font.rawValue)
        for name in arr {
            println(name)
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

function ios swift

-2
推荐指数
1
解决办法
607
查看次数