QuickDialog value too long for QLabelElement

Hi I have a QLabelElement and set the value for that like the following (same as in the sample app):

[s1 addElement:[[QLabelElement alloc] 
 initWithTitle:@"Long text long text long text long text" 
         Value:@"this is the value this is the value this is the value"]];

But now this element looks really ugly in the tableView cause obviously the text is too long:

how can I fix that? I am thinking about something like truncating the text or something but I have no idea where I can set that.

Answers


Ok it seams there is no easy way to solve my problem. The Solution is to costumize the QTableViewCell Class.

I rewrote it so the textlabel is the dominant one.

- (void)layoutSubviews {

    [super layoutSubviews];
    CGSize valueSize = CGSizeZero;

    if (self.textLabel.text!=nil)
        valueSize = [self.textLabel.text sizeWithFont:self.textLabel.font];


    CGSize imageSize = CGSizeZero;
    if (self.imageView!=nil)
        imageSize = self.imageView.frame.size;

    if (self.detailTextLabel.text ==nil) {
        CGRect labelFrame = self.textLabel.frame;
        self.textLabel.frame = CGRectMake(labelFrame.origin.x, labelFrame.origin.y,
                                          self.contentView.bounds.size.width - imageSize.width - 20, labelFrame.size.height);
        self.textLabel.backgroundColor = [UIColor   greenColor];
    }
    else{
        CGRect labelFrame = self.textLabel.frame;
        self.textLabel.frame = CGRectMake(labelFrame.origin.x, labelFrame.origin.y,
                                          valueSize.width, labelFrame.size.height);

    }




     CGRect detailsFrame = self.detailTextLabel.frame;
        self.detailTextLabel.frame = CGRectMake(self.textLabel.frame.origin.x + valueSize.width,
                                                detailsFrame.origin.y, self.contentView.bounds.size.width - valueSize.width - 
                                                imageSize.width - 20, detailsFrame.size.height);

}

If you have both long titles and long values then you can just add the following code to split den equally.

 if (valueSize.width > self.contentView.bounds.size.width/2) {
        valueSize.width = self.contentView.bounds.size.width/2;
    }

If you want to wrap a value text, please look at my change.


Need Your Help

Java : Compare, mark and interpret HTML texts in Java

java html string string-comparison

I am working on a Java project, where there is an HTML editor and the user can enter text in a html-editor(ckeditor) and the actual HTML text is saved in the database.

Open source Star rating integration for restaurants in ios

ios rating-system

I need to integrate star rating for different restaurants in ios app please help me with any open source library or something.