Я создаю приложение quizApp, используя DLRadioButton
с меткой в каждой ячейке tableView
, метка установлена на storyBoard
(с меткой), но я установил radioButtons программно для улучшения дизайна, когда я нажимаю кнопку Далее.нажмите кнопку, чтобы перейти к следующему вопросу. Новая радиопереключатель перекрывается со старой радиопереключателем
. Вот первый вопрос
![enter image description here](https://i.stack.imgur.com/7XTwF.png)
вот второе изображение
![enter image description here](https://i.stack.imgur.com/f9u8p.png)
Ниже мой код
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell : UITableViewCell = tableView.dequeueReusableCell(withIdentifier: "cell")!
var reponse = rep[(indexPath as NSIndexPath).row]
let content:UILabel=cell.viewWithTag(111) as! UILabel
//var ra:UIButton=cell.viewWithTag(112) as! UIButton
content.text=reponse["rep"] as? String
content.sizeToFit()
let repiii = reponse["rep"] as? String
// var radio = DLRadioButton()
if (self.type=="case à cocher"){
// cell.contentView.delete(radioButtons)
let frame = CGRect(x: 50, y: 20, width: 200, height: 40)
let squareButton = self.createRadioButton(frame: frame, title:repiii!, color: UIColor.red,compt: squareButtons.count,sqaure:1);
squareButtons.append(squareButton)
cell.contentView.addSubview(squareButton)
}
else{
let frame = CGRect(x: 50, y: 20, width: 200, height: 40)
let radioButton = self.createRadioButton(frame: frame, title:repiii!, color: UIColor.blue,compt: radioButtons.count,sqaure:0);
//radioButton.isMultipleSelectionEnabled = true
print(radioButtons.count)
radioButtons.append(radioButton)
cell.contentView.addSubview(radioButton)
}
return cell
}
приветствуется любое предложение