简体   繁体   English

UIButton在TableView单元格中不可见

[英]UIButton not visible in TableView Cell

I have parsed CSV file data and populating in a UITableView. 我已经解析了CSV文件数据,并在UITableView中进行了填充。 I have five labels and a button in the cell. 我在单元格中有五个标签和一个按钮。 The labels are showing data appropriately but the button is not visible. 标签正确显示了数据,但是按钮不可见。 I have dragged the button onto the storyboard. 我已将按钮拖动到情节提要上。 I have created a outlet variable also. 我也创建了一个出口变量。 But still the button is not visible. 但是按钮仍然不可见。 What could be the reason ? 可能是什么原因 ?

Even when i change the position of my label now and run the app it doesn't change. 即使当我现在更改标签的位置并运行应用程序时,它也不会更改。 Does this have something to do with core-data ? 这与核心数据有关吗? Because i have saved my csv data as core-data 因为我已经将csv数据保存为核心数据

Hit the runtime UI debugger key when in the considering VC is showing. 考虑中的VC显示时,请单击运行时UI调试器键。 The button should be above the console panel the second last one. 该按钮应在控制台面板上方,倒数第二个。 Right now am not in my mac so cant post a screenshot. 现在不在我的Mac中,因此无法发布屏幕截图。

Hit the button and observe that your button is being drawn beneath some view or your button is being drawn at all. 按下按钮,观察您的按钮是否在某个视图下绘制,或者根本没有绘制。 Plz confirm and comment 请确认并发表评论

I suggest you to apply auto layout constraints for button and labels. 我建议您对按钮和标签应用自动布局约束。 I think it will work. 我认为它将起作用。

REASON: your label is over your button. 原因:您的标签在按钮上方。 If you don't use auto layout label width get width of tableView (least the initial position x) and background default to white AUTO when your app running. 如果您不使用自动布局标签宽度,则在应用程序运行时,获取tableView的宽度(至少是初始位置x),背景默认为白色AUTO。

Change in code the label background to 'clear' and button will appear or search the button in the cell and use method 'bringSubviewToFront:'. 在代码中将标签背景更改为“清除”,然后将出现按钮或在单元格中搜索按钮并使用方法“ bringSubviewToFront:”。

BEST SOLUTION? 最佳解决方案? Use auto layout constraints. 使用自动布局约束。

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

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