RETableViewManager icon indicating copy to clipboard operation
RETableViewManager copied to clipboard

RETextItem. Space between label and textField

Open shmidt opened this issue 12 years ago • 14 comments

Same amount of characters for the "Place of birth", written in different languages gives different result:

screen shot 2013-10-26 at 23 06 54 screen shot 2013-10-26 at 23 09 55

How can I fix English version?

shmidt avatar Oct 26 '13 19:10 shmidt

Coukd you please post code that you're running?

romaonthego avatar Oct 27 '13 02:10 romaonthego

RETableViewSection *birthSection = [RETableViewSection sectionWithHeaderTitle:NSLocalizedString(@"Birth", nil)];
    [_manager addSection:birthSection];

    REDateTimeItem *dateOfBirth = [REDateTimeItem itemWithTitle:NSLocalizedString(@"Birth date", nil) value:_person.dateOfBirth placeholder:@"-" format:@"MMM d, y" datePickerMode:UIDatePickerModeDate];
    dateOfBirth.onChange = ^(REDateTimeItem *item){
        weakSelf.person.dateOfBirth = item.value;
        [weakSelf.managedObjectContext save:nil];
    };

    [birthSection addItem:dateOfBirth];

    RETextItem *birthPlace = [RETextItem itemWithTitle:NSLocalizedString(@"Place of Birth", nil) value:_person.placeOfBirth placeholder:NSLocalizedString(@"-", nil)];
    birthPlace.clearButtonMode = UITextFieldViewModeWhileEditing;
    birthPlace.autocapitalizationType = UITextAutocapitalizationTypeWords;
    birthPlace.textAlignment = NSTextAlignmentLeft;
    birthPlace.onEndEditing = ^(RETextItem *item){
        weakSelf.person.placeOfBirth = item.value;
        [weakSelf.managedObjectContext save:nil];
    };
    [birthSection addItem:birthPlace];

#pragma mark Styling
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    cell.textLabel.textColor = [UIColor colorWithRed:0.091 green:0.561 blue:0.989 alpha:1.000];
    cell.textLabel.font = [UIFont systemFontOfSize:14];
}

shmidt avatar Oct 27 '13 05:10 shmidt

I can't reproduce it... ios simulator screen shot oct 27 2013 11 48 15 am

romaonthego avatar Oct 27 '13 16:10 romaonthego

Can't understand what is the reason...

shmidt avatar Oct 27 '13 17:10 shmidt

There must be something else in your code that's causing it.

romaonthego avatar Oct 27 '13 18:10 romaonthego

Did you figure it out? Was the problem in your code or there's a bug?

romaonthego avatar Nov 02 '13 16:11 romaonthego

No, not yet. I'm pretty sure that there is no problem with my code, however I have suspicion that this problem somehow connected with localisation...

shmidt avatar Nov 02 '13 16:11 shmidt

Can it be that sizeWithFont is using the default text in english instead of the localized text?

ericertl avatar Nov 04 '13 13:11 ericertl

@ericertl Localized text is shown without any problems.

shmidt avatar Nov 05 '13 07:11 shmidt

@romaonthego I can send you the project via Dropbox, so you can check for yourself. I don't have any ideas why is this happens.

shmidt avatar Nov 05 '13 07:11 shmidt

@romaonthego That's weird, but I still can't figure it out what is wrong. If I place this item closer to the beginning or to the end of the table, spacing become even less. Also, scrolling has some gap at the bottom of the table view. ios simulator screen shot 30 nov 2013 23 52 54 ios simulator screen shot 01 dec 2013 00 06 15

P.S.: I don't have any scroll view delegate methods. My first suspicion was on the collection view, which is used as table header view, but I even removed it and got the same results.

shmidt avatar Dec 01 '13 08:12 shmidt

And if I change text alignment to right, _birthPlace.textAlignment = NSTextAlignmentRight; then textField and label swap places. ios simulator screen shot 16 feb 2014 13 35 35

shmidt avatar Feb 16 '14 09:02 shmidt

void (^onChange)(RETextItem *item) can you please tell me what is the purpose of this? and how to define these properties??? Urgent help required.

pun777chy avatar Mar 05 '14 08:03 pun777chy

I can't right align the value of item. If I use item.textAlignment, it exactly does what shmidt said. How do you right align the value of the item keeping the title left aligned? Is there a way to do that?

afshine avatar Jun 24 '14 23:06 afshine