如何在视图中创建表格我不希望表格掩盖我的整个屏幕

问题描述

| 有什么办法..我可以在视图中创建一个UITableView,使其不会覆盖整个屏幕... 例如 : 我希望屏幕的前半部分是UITextView,屏幕的下半部分是 UITableView。 提前致谢     

解决方法

CGRect cgRct = CGRectMake(0,50,320,250);  
UITableView *tableView1 = [[UITableView alloc] initWithFrame:cgRct style:UITableViewStylePlain];  
    //tableView.editing = YES;  
    tableView1.dataSource = self;  
    tableView1.delegate = self;  
    tableView1.backgroundColor=[UIColor clearColor];  
[self.view addSubview:tableView1];
    ,您可能正在为tableView创建一个UITableViewController,然后意识到您无法更改tableView的大小。我对吗?如果是这种情况,则不要创建UITableViewController,只需创建一个普通的UIViewController,然后使用Interface Builder或其他人在此处发布的代码添加tableView。     ,在Interface Builder中(如果使用的话),只需将UITableView拖放到UIView并调整其在Inspector中的宽度,高度和y位置。 如果您以编程方式创建视图,请更改UITableView的框架
CGRect tablefrm = [tableViewObject frame];
tablefrm.origin.y = 240.0f //new origin
tablefrm.size.height = 240.0f; //new height
[tableViewObject setFrame:tablefrm]; //assuming already added the tableview to the view.
    

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...