小编Zub*_*ala的帖子

在120个字符后附加readmore标签,并使其在ios中可点击

数据来自解析器,如果文本超过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)

ios swift

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

在Swift 3中将UIImage顺时针旋转270度的正确方法是什么?

UIView.animate(withDuration:2.0, animations: {

         self.imageView.transform = CGAffineTransform(rotationAngle: (270 * CGFloat(2 * Double.pi)) / 360.0)
    })
Run Code Online (Sandbox Code Playgroud)

这是逆时针动画,我希望动画顺时针旋转。

ios swift swift3

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

设置Alamofire自定义目标文件名,而不是在Swift 3.0中使用suggestDownloadDestination

如何在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)

alamofire swift3

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

标签 统计

ios ×2

swift ×2

swift3 ×2

alamofire ×1