CooperRS / RMActionController

This is an iOS control for presenting any UIView in an UIAlertController like manner
MIT License
539 stars 59 forks source link

Tableview #12

Closed diogo10 closed 8 years ago

diogo10 commented 8 years ago

Hii guys,

Iam tryng to add an tableview. I attached one print screen. What's do you think?

screen shot 2016-01-07 at 17 30 02

I can see the prints...the data is ok


    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
    {
        print("came here = " + self.pickerData[indexPath.row])
        let cell:UITableViewCell = self.pickerView.dequeueReusableCellWithIdentifier("cell")! as UITableViewCell
        cell.textLabel?.text = self.pickerData[indexPath.row]

        if(indexPath.row % 2 == 0){
            cell.backgroundColor = UIColor.grayColor()
        } else{
            cell.backgroundColor = UIColor.whiteColor()
        }

        return cell
    }

//where I add the tableview
  let newFrame4 = CGRectMake(0, 170, 300, 100)// 0 center - 120 top margin
        pickerView.frame = newFrame4
        self.contentView.addSubview(pickerView)
CooperRS commented 8 years ago

Do you have a height constraint for self.contentView?

diogo10 commented 8 years ago

Yes....

  let bindings = ["contentView": self.contentView];
        self.contentView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("[contentView(>=300)]", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: bindings))
        self.contentView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:[contentView(400)]", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: bindings))//size of the screen
CooperRS commented 8 years ago

You may also need to disable blur effects for the content view (property disableBlurEffectsForContentView).

With this property set to YES, I was able to add a tableView to the content view of an RMActionController :)

simulator screen shot 08 01 2016 18 24 38

diogo10 commented 8 years ago

Thanks man! work like a charm =D