有一个需求,需要动态创建一些控制器,在图片中我添加了隐藏UITableView的UITextField
。
UITableView默认是隐藏的。到用户触屏到UIButton后,UITableView才显示。
问题是,在UITableView 显示之后,怎么样让UITableView 顶置?
谢谢
试试:
[self.view bringSubviewToFront: yourTableView];
要修改顺序,先添加 UItextfield
[self.view addSubview:yourTextField];
然后添加tableview 和其他视图:
[self.view addSubview:yourTableView];
我觉得用这段代码试试:
UITextField *txtFld = [[UITextField alloc] initWithFrame:CGRectMake(65, 300, 200, 30)];
txtFld.backgroundColor = [UIColor clearColor];
// Border Style None
[txtFld setBorderStyle:UITextBorderStyleNone];
[txtFld setPlaceholder:@"Name"];
[self.view addSubview:txtFld];