[英]how can I draw a Table view programmatically
I want to draw a table view programitacllay b/c I face one problem, and the problem is that I have two views , whenever the sencond view is come the table view will be drawn downside, and when this view disable the table view is drawn upside... 我想绘制一个表视图programitacllay b / c我遇到一个问题,问题是我有两个视图,每当第二个视图到来时,该表视图都将被绘制到下方,而当该视图禁用时,该表视图将被绘制向上...
How can I resolve it... 我该如何解决...
Are you using some event to draw second view? 您是否正在使用某个事件绘制第二个视图? If so then in that you will need to set the center of tableView using method .......
[yourTableView setCenter:[coord where you want it to be]];
如果是这样,那么您将需要使用方法.......
[yourTableView setCenter:[coord where you want it to be]];
来设置tableView的中心[yourTableView setCenter:[coord where you want it to be]];
... just detect the seconds views presence either by setting its tag to some value and then checking whether a view with that tag is available than adjust the position of tableview ...只需通过将其标签设置为某个值,然后检查具有该标签的视图是否可用,而不是调整表视图的位置,来检测秒视图的存在
[secondView setTag:2];
//somewhere you create secondView...... //在创建secondView的地方......
in the event ...... 万一......
if([self.view viewWithTag:2]!=nil{//i am considering you have added views on self.view.
//second view exists
}
else{
//second view is not there.....
}
Thanks, 谢谢,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.