UILabel in UITable do not get display but get disp

2019-06-13 20:04发布

  1. Referring Image number 1: In ios 6 and 5, the label get display properly in UItable. Image_1

  2. Referring Image number 2: In IOS 7, the label do not get display in UItable. Image_2

  3. Referring Image number 3: In iOS 7, the label get display on click of cell in UItable. Image_3

  4. Below is the code used to write cell in UItable.

    -(UILabel *)createLabel:(UILabel *)sender1 :(int)x :(int)y :(NSString *)title :(int)size :(int)swidth :(int)ht
       {
         sender1 = [[UILabel alloc] initWithFrame:CGRectMake(x, y, swidth, ht)];
         sender1.text = title;
         [sender1 setTextColor:[UIColor whiteColor]];
         [sender1 setBackgroundColor:[UIColor clearColor]];
         [sender1 setFont:[UIFont systemFontOfSize:size]];
         sender1.numberOfLines = 2;  //7
    
         sender1.lineBreakMode = NSLineBreakByWordWrapping;
         sender1.contentMode = UIControlContentVerticalAlignmentCenter;
    
        return sender1;
      }
    

    I am sure it is not simulator issue.

1条回答
Juvenile、少年°
2楼-- · 2019-06-13 21:01
  1. The issue was with the default background colour of the cell.
  2. In Ios 6 and 5 it use to set black but in Ios 7 it is set to White.

    [cell setBackgroundColor:[UIColor blackColor]]; is the solution.

查看更多
登录 后发表回答