1

How do I programmatically bring a label to the front of a blurred effect view which was added programmatically?

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) ->
        UITableViewCell {

        println("celler \(indexPath.row)")

        var cell:MainViewTableViewCell = self.mainTableView.dequeueReusableCellWithIdentifier("mainTableViewCell", forIndexPath:indexPath) as MainViewTableViewCell

        cell.mainTableViewCellTitle?.text = feedRow.title <<<<<<<< this on top of blurred

        var url =  String(format: "http://localhost:5000/%@")
        let data = NSData(contentsOfURL:NSURL(string: url)!)

        var image = UIImage(data:data!)

        cell.mainTableViewCellBackgroundImage.image = image

        var effect = UIBlurEffect(style: .Light)

        var effectView = UIVisualEffectView(effect: effect)

        var height_of_header = (cell.bounds.height*0.2)
        var y_position = (cell.bounds.height-height_of_header)
        effectView.frame = CGRect(x: 0,y: y_position ,width: cell.bounds.width,height:height_of_header)
        cell.addSubview(effectView)

        cell.mainTableViewCellBackgroundImage.layer.masksToBounds = true
}

The label was created using a storyboard. I'm not sure if I am able to mix and match like this for swift.

cell.mainTableViewCellTitle?.text <<<< This is the label which I want to bring in front.

Thanks in advance!

4

0 回答 0