UIlabel with Custom cell not appear

I'm confused !, it is not my first time to create Custom Cell but this time UILabel doesn't appear I don't know where is the problem ?

This the custom cell Cell.m

        mainView = [[UIView alloc] initWithFrame:CGRectZero];
        mainView.backgroundColor = [UIColor colorWithRed:249.0/255.0 green:249.0/255.0 blue:249.0/255.0 alpha:1.0];
        profile = [[UIImageView alloc] initWithFrame:CGRectZero];
        profile.layer.masksToBounds = YES;
        profile.layer.cornerRadius = 22.5;
        profile.layer.borderColor = [UIColor whiteColor].CGColor;
        profile.layer.borderWidth = 1.0f;
        profile.clipsToBounds = YES;
        tweet_is = [[UILabel alloc] initWithFrame:CGRectZero];
        tweet_is.font = [UIFont fontWithName:@"HelveticaNeue-Thin" size:20];
        tweet_is.backgroundColor = [UIColor clearColor];
        tweet_is.textColor = [UIColor blackColor];
        [self.mainView addSubview:tweet_is];
        [self.mainView addSubview:profile];
        [self.contentView addSubview:self.mainView];

-(void)layoutSubviews {

    [super layoutSubviews];
    self.mainView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height - 10.0f);
    self.profile.frame = CGRectMake(15, 15, 45, 45);
    self.tweet_is.frame = CGRectMake(30, 30, 300.0f, 300.0f);

} 

This is the tableView

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    Cell *cell = (Cell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (!cell) {
        cell = [[Cell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }
    cell.tweet_is.text = @"Not approve";
    return cell;
}

Answers


Change this line:

self.tweet_is.frame = CGRectMake(30, 30, 300.0f, 300.0f);

set it self.tweet_is.frame = CGRectMake(30, 30, 300.0f, 30.0f);

If your cell height is less than 300 (I think it is) then you can not see the text. Let me know if that helps.. :)


Need Your Help

Which image format is cost effective in terms of network operation for iPhone?

iphone image format

I want to display a thumbnail image in a cell of tableViewController, this thumbnail image is located at some remote place (URL of address is in XML file) so which format of image is cost effective?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.