html页面tabale居中的问题

html页面tabale居中的问题,第1张

<html>

<head>

<meta http-equiv="Content-Type" content="text/html charset=utf-8" />

<title>无标题文档</title>

</head>

<body>

<style type="text/css">

*{margin:0padding:0}

</style>

<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td align="center" valign="middle">

<table width="80%" height="80%" border="1" cellspacing="0" cellpadding="0">

  <tr>

    <td>&nbsp</td>

    <td>&nbsp</td>

    <td>&nbsp</td>

    <td>&nbsp</td>

  </tr>

  <tr>

    <td>&nbsp</td>

    <td>&nbsp</td>

    <td>&nbsp</td>

    <td>&nbsp</td>

  </tr>

  <tr>

    <td>&nbsp</td>

    <td>&nbsp</td>

    <td>&nbsp</td>

    <td>&nbsp</td>

  </tr>

</table>

</td>

</tr>

</table>

</body>

</html>

就是你打算让他有几行就返回多少,假设你要返回10行,就

return 10

返回的行数就是你打算让这个表显示出几行的内容~

首先要 viewcontroller<UITabaleViewDatasource,UITableViewDelegate>,

然后

table.datasource = self

table.delegate = self

#pragma mark - UITableViewDataSource

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

{

return 10//默认只有一个section,需要10行

}

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

{

//indexPath包含 section,row两个信息

UITableViewCell *cell..//设置cell的属性

return cell//返回每一行的cell

}


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/bake/11518873.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-16
下一篇 2023-05-16

发表评论

登录后才能评论

评论列表(0条)

保存