如何将工具栏添加到UITableView obj-c / ios / xcode的BOTTOM
问题描述:
如何在tableview底部添加带有uitextfield的Programmaticaly工具栏?喜欢聊天或短信应用..提前谢谢..
how do I add Programmaticaly a toolbar with uitextfield at the bottom of a tableview? Like a chat or sms app.. thank you in advance..
答
首先创建一个视图来保存整个事物。
然后添加一个UITableview和UIToolbar以编程方式设置框架,使其显示在tableview下。将文本字段添加到工具栏
First create a view to hold the whole thing. Then add a UITableview and UIToolbar programmatically set frame so that it appears under the tableview .Add the textfield to the toolbar
UIView *placeholderView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 400, 440)];
UITableView *tv=[[UITableView alloc]initWithFrame:CGRectMake(0, 0, 400, 400)];
[placeholderView addSubview:tv];
UIToolbar *toolBar=[[UIToolbar alloc]initWithFrame:CGRectMake(0, 400, 400, 40)];
[placeholderView addSubview:toolBar];