Hello,

to whom it may concern, the problem was that I overrode layoutSubviews without 
calling super. this way it works:

- (void)layoutSubviews {
        [super layoutSubviews];
        CGRect r;
        //set rect
        self.textLabel.frame = r;
        self.textLabel.text = @"xxx";
}

regards,
sebastian mecklenburg


On 03.08.2010, at 19:24, sebi wrote:

> Hello,
> 
> In my project (iPad) I use a UITableViewCell subclass. The problem is, that 
> the built in textLabel doesn't show the text.
> Here is some test code:
> 
> -(void)setText:(NSString*)text {
>       CGRect r;
>       r.origin.x = 30;
>       r.origin.y = 5;
>       r.size.width = self.bounds.size.width - 50;
>       r.size.height = self.bounds.size.height - 10;
> //    self.textLabel.frame = r;
> //    self.textLabel.text = @"xxx";
>       UILabel* textLabel = [[UILabel alloc] initWithFrame:r];
>       textLabel.text = @"xxx";
>       [self addSubview:textLabel];
>       [textLabel release];
> }
> 
> when I uncomment the two lines and comment out the last three lines it 
> doesn't work, no text visible. The _textLabel member of the UITableViewCell 
> superclass is not nil and its parameters are set correctly.
> I mean, it works now (I have to make my textLabel a member and add it only 
> once as a subview of course) but I would still be interested what I am doing 
> wrong.
> 
> Thanks and regards,
> Sebastian Mecklenburg_______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/sebi%40happyhappyboy.de
> 
> This email sent to s...@happyhappyboy.de
> 

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to