简体   繁体   English

xamarin.ios-以编程方式将视图添加到tableitem

[英]xamarin.ios - adding views to tableitem programmatically

I'm building an interface in codes from scratch (there's nothing in XIB file). 我正在从头开始在代码中构建接口(XIB文件中没有内容)。 I'm adding a tableitem that consists of some cells and those cells contains one or more views (UIButton, UITextField, etc.) 我要添加一个由一些单元格组成的表格项,这些单元格包含一个或多个视图(UIButton,UITextField等)。

The problem is none of the items are clickable/editable! 问题是所有项目均不可点击/可编辑! When I click TextFields or Buttons, nothing happens! 当我单击TextFields或Buttons时,什么也没有发生! No highlighting, no cursor changing nothing at all... 没有突出显示,没有光标完全没有改变...

What I'm missing here? 我在这里想念的是什么?

Also constructed the cells programmatically. 还以编程方式构造了单元。 I am adding controls directly to the UITableViewCell. 我直接将控件添加到UITableViewCell。

One possible issue: some of your views (may be ContentView or the UITableViewCell) hides the controls from manipulation. 一个可能的问题:您的某些视图(可能是ContentView或UITableViewCell)使控件无法操作。 You should set that [UIView].userInteractionEnabled to false. 您应该将[UIView] .userInteractionEnabled设置为false。 You can also try to implement touch listeners to your views to recognize which one hides your controls. 您也可以尝试对视图实现触摸侦听器,以识别隐藏了控件的视图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM