[Swift]UIColor SampleColor
6574 단어 Swift
tableView
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell: UITableViewCell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: "Cell")
let colors: [(color: UIColor, text: String)] = [
(UIColor.blackColor(),"blackColor"),
(UIColor.darkGrayColor(),"darkGrayColor"),
(UIColor.lightGrayColor(),"lightGrayColor"),
(UIColor.whiteColor(),"whiteColor"),
(UIColor.grayColor(),"grayColor"),
(UIColor.redColor(),"redColor"),
(UIColor.greenColor(),"greenColor"),
(UIColor.blueColor(),"blueColor"),
(UIColor.cyanColor(),"cyanColor"),
(UIColor.yellowColor(),"yellowColor"),
(UIColor.magentaColor(),"magentaColor"),
(UIColor.orangeColor(),"orangeColor"),
(UIColor.purpleColor(),"purpleColor"),
(UIColor.brownColor(),"brownColor"),
(UIColor.clearColor(),"clearColor")]
cell.textLabel?.text = colors[indexPath.row].text
cell.backgroundColor = colors[indexPath.row].color
if (cell.backgroundColor == UIColor.blackColor())
{
cell.textLabel?.textColor = UIColor.whiteColor()
}
return cell
}
참조 소스https://github.com/senseiswift/UIColorSample
Reference
이 문제에 관하여([Swift]UIColor SampleColor), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/senseiswift/items/857164c4a29fd7b39065텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)