今天在自己写tableviewcell动态高度的时候遇到一个问题,就是在cell当中添加label作为contentview
,显示文字。可是文字右边部分会出现空白,不是充满整个tableview,如下图所示:
代码如下:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *identify=@"myCell";
UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:identify];
if (cell==nil)
{
cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identify];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero];
label.tag = 1;