BlakeBoxberger / Roman

Turn the modern iOS status bar time to Roman numerals!
MIT License
2 stars 2 forks source link

The full time is not always shown #2

Open ryannair05 opened 4 years ago

ryannair05 commented 4 years ago

As you can see by the pictures below the full time is not always shown. Ellipses are shown instead. This happens whenever the time becomes really long

IMG_0085 IMG_0086 IMG_0087

BlakeBoxberger commented 4 years ago

_UIStatusBarStringView is a UILabel. Just set adjustsFontSizeToFitWidth to "YES" on the label.

ryannair05 commented 4 years ago

How would you do that? I tried adding - (BOOL) adjustsFontSizeToFitWidth to the _UIStatusBarStringView hook and I tried hooking UILabel itself, but they both didn't work.

BlakeBoxberger commented 4 years ago

There are a couple ways you can go about doing that. In order to set the property on that label, you have to have an instance of the label.

The current version of this tweak is not very efficient. _UIStatusBarStringView is used by every status bar text (like the time, the "LTE" text, and the carrier label). I use a "hacky" solution by checking for occurrences of ":" in the string when the text is set on any _UIStatusBarStringView object. If it's in the string, then I assume that the current object must be the time label.

An easy solution would be to insert "self.adjustsFontSizeToFitWidth = YES" in the section of code where the label is checked.

A better and more efficient solution would be to find where the _UIStatusBarStringView timeLabel is, and manually set the text ourself every minute with the correct time. (Hint: You can find the timeLabel in the UIStatusBar's items property.)