How to add a toolbar to the BOTTOM of a UITableView obj-c/ios/xcode

后端 未结 4 1644
误落风尘
误落风尘 2021-02-06 15:07

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..

4条回答
  •  终归单人心
    2021-02-06 16:09

    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]; 
    

提交回复
热议问题