can't click UIButton inside a cell in UITableview

前端 未结 13 1797
生来不讨喜
生来不讨喜 2021-02-05 09:51

searched already some possible fixes but all did not solve mine.

i keep clicking the cell in the uitableview rather than the buttons inside it.

here is my code:

13条回答
  •  时光说笑
    2021-02-05 10:27

    try this

    public override void SetSelected(bool selected, bool animated)
        {
           // this.interestsButton.Selected = true;
            if (selected)
            {
                //  this.TextLabel.TextColor = UIColor.Red;
    
                //this.interestsButton.ShowsTouchWhenHighlighted = true;
                this.interestsButton.BackgroundColor = UIColor.Purple;
                //this.interestsButton.SetTitleColor(UIColor.Red, UIControlState.Highlighted);
            }
            else
            {
    
            }
    
    
           // cell.ContentView.UserInteractionEnabled = false;
            base.SetSelected(selected, animated);
    
    
        }
    

    Tested on "Mvvmcross.iOS" only

提交回复
热议问题