数据来自解析器,如果文本超过120个字符,那么它应该像facebook一样追加"... ReadMore".我有附加文本的代码,但不知道如何制作可点击的链接.我正在使用Swift Languange.
if cell!.bhikmangaTextlbl!.text!.utf16Count >= 120
{
var abc : String = (cell!.bhikmangaTextlbl!.text! as
NSString).substringWithRange(NSRange(location: 0, length: 120))
abc += " ...ReadMore"
cell!.bhikmangaTextlbl!.text = abc
}
Run Code Online (Sandbox Code Playgroud) UIView.animate(withDuration:2.0, animations: {
self.imageView.transform = CGAffineTransform(rotationAngle: (270 * CGFloat(2 * Double.pi)) / 360.0)
})
Run Code Online (Sandbox Code Playgroud)
这是逆时针动画,我希望动画顺时针旋转。
如何在swift 3.0中编写以下代码段?以下语法在swift 2中
Alamofire.download(.POST, invoice.url,parameters:params, destination: { (url, response) -> NSURL in
let pathComponent = response.suggestedFilename
let fileManager = NSFileManager.defaultManager()
let directoryURL = fileManager.URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0]
let fileUrl = directoryURL.URLByAppendingPathComponent(pathComponent)
return fileUrl
})
.progress { bytesRead, totalBytesRead, totalBytesExpectedToRead in
print(totalBytesRead)
dispatch_async(dispatch_get_main_queue()) {
let progress = Double(totalBytesRead) / Double(totalBytesExpectedToRead)
completionHandler(progress, nil)
}
}
.responseString { response in
print(response.result.error)
completionHandler(nil, response.result.error)
}
Run Code Online (Sandbox Code Playgroud)