我可以将我的iBeacon发送推送通知到Android设备吗?如果是这样,Android版本和设备限制是什么?
(我在这里问的原因是因为在快速谷歌搜索中仍然不容易找到这个问题.)
这两种方法之间的区别是什么来获取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) 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)
他们都打印出相同的值,这两者之间的区别是什么?是否存在应该使用特定场景的特定场景?
我有一个项目 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 需要。是什么原因?
如何for在Swift 2.2中实现这样的C风格循环?
for var level: Double = 10; level <= 100; level += 10 {
}
Run Code Online (Sandbox Code Playgroud) 我想在对它进行像素操作之前裁剪UIImage(不是imageview).在ios框架中有可靠的方法吗?
以下是我正在使用的android中的相关方法:
http://developer.android.com/reference/android/graphics/Bitmap.html#createBitmap(android.graphics.Bitmap,INT,INT,INT,INT) http://developer.android.com/reference/android/ graphics/Bitmap.html #createBitmap(int,int,android.graphics.Bitmap.Config)
在视频教程中:
快速无脚本教程介绍苹果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)
我在这里错过了什么?
var number = 3
Run Code Online (Sandbox Code Playgroud)
对比
var number: Int = 3
Run Code Online (Sandbox Code Playgroud)
使用特定类型与类型推断如何影响编译时间?有没有人做过这个主题的实验或一些数学运算?
这个运行时到底有没有影响?
我调用此函数,调用控制台日志但未调用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)
我在这里错过了什么?
@清单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)
这个图像道具定位应该是什么?
什么样的对象?
我该如何设置?
这两个有什么区别?
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) swift ×6
ios ×5
objective-c ×2
android ×1
chai ×1
ciimage ×1
crop ×1
dictionary ×1
frame ×1
frameworks ×1
function ×1
ibeacon ×1
javascript ×1
mocha.js ×1
performance ×1
swift2 ×1
typescript ×1
uiimage ×1
uikit ×1
uitableview ×1
uiview ×1
webstorm ×1
xcode6 ×1