我意识到这个问题已被问过几次,我已经按照答复进行操作,但它对我不起作用。
我有一个 UITableView
,在 .h 文件中包含以下内容:
@interface ObViewControllerPreObsInfo : UIViewController < UITableViewDelegate, UITableViewDataSource>
并在viewDidLoad中设置delegate
和dataSource
:
[tableViewNames setDelegate: self];
[tableViewNames setDataSource: self];
但是当我尝试时:
self.tableViewNames.frame.origin = 280;
我得到了错误
Expression is not assignable
有什么建议吗?
最佳答案
您必须创建一个新框架,然后将其分配给 View 。试试这个:
CGRect frame = self.tableViewNames.frame;
frame.origin.x = 20;
frame.origin.y = 20;
self.tableViewNames.frame = frame;
关于ios - 以编程方式定位 UITableView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32170810/