Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/99.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 我可以将tableview添加到具有其他控件的视图中吗?_Iphone_Ios_Xcode - Fatal编程技术网

Iphone 我可以将tableview添加到具有其他控件的视图中吗?

Iphone 我可以将tableview添加到具有其他控件的视图中吗?,iphone,ios,xcode,Iphone,Ios,Xcode,我可以在interface builder中将tableview添加到现有视图中吗 我的界面生成器如下所示 但是,当我在模拟器中运行代码时,您可以看到该表与interface builder中显示的位置不同,因为它覆盖了底部的按钮 更新…我有点进步,但底部的按钮被隐藏了 修复了…,建议使用以下代码:) } }确保已将tableview的委托和数据源附加到文件所有者。您还必须至少实现这两种方法 - (NSInteger)tableView:(UITableView *)tableView n

我可以在interface builder中将tableview添加到现有视图中吗

我的界面生成器如下所示

但是,当我在模拟器中运行代码时,您可以看到该表与interface builder中显示的位置不同,因为它覆盖了底部的按钮

更新…我有点进步,但底部的按钮被隐藏了

修复了…,建议使用以下代码:)

}


}

确保已将tableview的委托和数据源附加到文件所有者。您还必须至少实现这两种方法

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;

// Row display. Implementers should *always* try to reuse cells by setting each cell's reuseIdentifier and querying for available reusable cells with dequeueReusableCellWithIdentifier:
// Cell gets various attributes set automatically based on table (separators) and data source (accessory views, editing controls)

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;

将自动调整大小应用于.xib文件中的那些子视图,如下所示

您可以使用以下功能进行编程更改

UIViewAutoresizing
Specifies how a view is automatically resized.

enum {
   UIViewAutoresizingNone                 = 0,
   UIViewAutoresizingFlexibleLeftMargin   = 1 << 0,
   UIViewAutoresizingFlexibleWidth        = 1 << 1,
   UIViewAutoresizingFlexibleRightMargin  = 1 << 2,
   UIViewAutoresizingFlexibleTopMargin    = 1 << 3,
   UIViewAutoresizingFlexibleHeight       = 1 << 4,
   UIViewAutoresizingFlexibleBottomMargin = 1 << 5
}; 

在datasource方法中,返回页脚视图(包含“保存和编辑”和“下一步”UIButtons的UIView)。

可能是因为自动对齐。不确定,但请检查tableview的自动调整大小。是的,您可以,猜猜您已经做了什么:)。Rest只是在你的桌面视图中解锁底部并添加拉伸。我不确定这个方法需要做什么???我已经用最新的屏幕截图更新了我的问题-如你所见-按钮由于某种原因被隐藏?创建一个UIView并将按钮添加到该视图对象中,然后以我提到的方法返回。试试看。。请参阅。此方法是UITableViewDataSource方法,在为相关节创建节页脚时会触发。
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;

// Row display. Implementers should *always* try to reuse cells by setting each cell's reuseIdentifier and querying for available reusable cells with dequeueReusableCellWithIdentifier:
// Cell gets various attributes set automatically based on table (separators) and data source (accessory views, editing controls)

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
UIViewAutoresizing
Specifies how a view is automatically resized.

enum {
   UIViewAutoresizingNone                 = 0,
   UIViewAutoresizingFlexibleLeftMargin   = 1 << 0,
   UIViewAutoresizingFlexibleWidth        = 1 << 1,
   UIViewAutoresizingFlexibleRightMargin  = 1 << 2,
   UIViewAutoresizingFlexibleTopMargin    = 1 << 3,
   UIViewAutoresizingFlexibleHeight       = 1 << 4,
   UIViewAutoresizingFlexibleBottomMargin = 1 << 5
}; 
  [yourViews.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoResizingFlexibleWidth];
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section