我安装了testFlight,将应用程序添加到iTunes连接,然后使用testFlight下载它.我的测试应用无法连接到互联网.但如果我通过电缆上传我的应用程序 - 互联网工作.
我从网站获取数据(HTML字符串).我想提取所有链接.我写函数(它有效),但它太慢了......
你能帮我优化一下吗?我可以使用哪些标准功能?功能逻辑:在文本中找到"http:.//"sting,然后读取字符串(购买字符)直到我不会得到"\"".
extension String {
subscript (i: Int) -> Character {
return self[advance(self.startIndex, i)]
}
subscript (i: Int) -> String {
return String(self[i] as Character)
}
subscript (r: Range<Int>) -> String {
return substringWithRange(Range(start: advance(startIndex, r.startIndex), end: advance(startIndex, r.endIndex)))
}}
func extractAllLinks(text:String) -> Array<String>{
var stringArray = Array<String>()
var find = "http://" as String
for (var i = countElements(find); i<countElements(text); i++)
{
var ch:Character = text[i - Int(countElements(find))]
if (ch == find[0])
{
var j = 0
while (ch == …
Run Code Online (Sandbox Code Playgroud) 我在TableViewCell上有故事板segue,我用它在单击单击didSelectRowAt
方法中转移到另一个VC .现在我做了双击TapGestureRecognizer
以处理细胞上的轻微敲击.问题是,单击时,segue正在执行,双击不起作用.单击单元格,双击可正常工作.到目前为止我的代码可能以某种方式解决这个问题吗?或者我需要删除segue并单独处理单击和双击.谢谢你的任何建议
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let doubleTap = UITapGestureRecognizer(target: self, action: #selector(handleDoubleTap))
doubleTap.numberOfTapsRequired = 2
view.addGestureRecognizer(doubleTap)
}
func handleDoubleTap(recognizer: UIGestureRecognizer) {
let p = recognizer.location(in: tableView)
let indexPath = tableView.indexPathForRow(at: p)
if let _ = indexPath {
tableView.deselectRow(at: indexPath!, animated: true)
update(index: (indexPath?.row)!, isFinished: true)
}
print ("doubke")
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if (segue.identifier == "showSingleTask") …
Run Code Online (Sandbox Code Playgroud)