tableview = UITableView(frame: CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height-49-64), style: UITableViewStyle.Plain)
let bgview : UIImageView = UIImageView(image: UIImage(named: "BJ"))
tableview.backgroundView = bgview
tableview.delegate = self;
tableview.dataSource = self
// 行与行之间分割线的颜色 用了separatorEffect之后separatorColor不起作用
tableview.separatorColor = UIColor.redColor()
tableview.separatorStyle = UITableViewCellSeparatorStyle.SingleLine
let blurEffect :UIBlurEffect = UIBlurEffect(style: UIBlurEffectStyle.ExtraLight)
let vibrancyEffect : UIVibrancyEffect = UIVibrancyEffect(forBlurEffect: blurEffect)
// 行与行之间分割线的效果
tableview.separatorEffect = vibrancyEffect
//设置索引文本的颜色
tableview.sectionIndexColor = UIColor.redColor()
//不触摸,正常显示索引的颜色
tableview.sectionIndexBackgroundColor = UIColor.greenColor()
//触摸到索引显示索引的另一个颜色
tableview.sectionIndexTrackingBackgroundColor = UIColor.clearColor()
tableview.sectionIndexMinimumDisplayRowCount = 10
tableview.registerClass(UITableViewCell.self, forCellReuseIdentifier: "cell")
self.view.addSubview(tableview)
UITableView
最新推荐文章于 2025-06-06 15:30:45 发布