Welcome, Guest
Username Password: Remember me

Localized "Edit" button in detail view not fully visible
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Localized "Edit" button in detail view not fully visible

Localized "Edit" button in detail view not fully visible 1 year, 5 months ago #1

Hello,

the "Edit" button in a detail view is not fully visible when the button's label is localized. In my case it says "Bearbeiten" (German for "Edit").

Thanks,
Patrick

IMG_0123.png
  • Patrick
  • OFFLINE
  • Senior Boarder
  • Posts: 49
  • Karma: 3
Last Edit: 1 year, 5 months ago by Patrick.

Re: Localized "Edit" button in detail view not fully visible 1 year, 5 months ago #2

Hi Patrick,

The Add and Edit buttons are actually sitting on a transparent toolbar here. We've tried determining the size of the Edit button at runtime so that we would resize the toolbar accordingly, but Apple does not provide any kind of way to determine that. Even trying to get the button's size from it's text doesn't work, as there is no way to determine a UIBarButtonItem's font.

What we can do however is give you direct control over the width of the toolbar by providing an SCTableViewController property called "toolbarWidth". Tell me what you think.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: Localized "Edit" button in detail view not fully visible 1 year, 5 months ago #3

Hi Tarek,

that looks like a good "solution", but I think I might have an even better idea.

As you cannot determine the button's size at runtime, you could just get the editButton.title (which returns a NSString) and calculate how wide this string would be under usage of the button's font. (Which should be systemOfFontSize:12.0 I guess). Then you could set frame.width of the transparent toolbar to this value and add the width for the addButton:

SCTableViewController.m >> viewWillAppear:
CGSize buttonSize = [self.editButton.title sizeWithFont:[UIFont systemFontOfSize:12.0]];
 
// Create the toolbar that will hold the Add and Edit buttons
SCTransparentToolbar* toolbar = [[SCTransparentToolbar alloc] initWithFrame:CGRectMake(0, 0, 80 + buttonSize.width, 44.01)];


What do you think, Tarek?
  • Patrick
  • OFFLINE
  • Senior Boarder
  • Posts: 49
  • Karma: 3
Last Edit: 1 year, 5 months ago by Patrick.

Re: Localized "Edit" button in detail view not fully visible 1 year, 5 months ago #4

Hi Patrick,


you could just get the editButton.title (which returns a NSString) and calculate how wide this string would be under usage of the button's font


That's the problem I was referring to earlier The whole issue is that there is no way to get the button's font. It's not a good idea to just hard code it as systemOfFontSize:12 (which I am not even sure it's the correct font), as this may change on the iPad for example or with future SDK updates or future devices.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: Localized "Edit" button in detail view not fully visible 1 year, 5 months ago #5

tarekskr wrote:
That's the problem I was referring to earlier The whole issue is that there is no way to get the button's font. It's not a good idea to just hard code it as systemOfFontSize:12 (which I am not even sure it's the correct font), as this may change on the iPad for example or with future SDK updates or future devices.


You are right. I must have overseen that, sorry.
Then your solution would be the best, I guess.
  • Patrick
  • OFFLINE
  • Senior Boarder
  • Posts: 49
  • Karma: 3
Last Edit: 1 year, 5 months ago by Patrick.

Re: Localized "Edit" button in detail view not fully visible 1 year, 5 months ago #6

Great, we'll have it ready for our next update.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72
  • Page:
  • 1
Time to create page: 0.96 seconds