UILabel in UITable do not get display but get display on click in IOS 7 (due to issue with background colour)

风流意气都作罢 提交于 2019-12-23 05:26:07

问题


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

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

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

  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:


  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.



来源:https://stackoverflow.com/questions/20186689/uilabel-in-uitable-do-not-get-display-but-get-display-on-click-in-ios-7-due-to

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!