Doesn't that just break the line up with the delimiter "\n"? My question was if we could do something similar to UILabel.numberofLines = 0.
Post
Replies
Boosts
Views
Activity
Bumping this up, I think this is still an issue. Is there any way around this? If we use attributedString, how do set number of lines?
Gotcha, thanks!
What would be the equivalent refactor if we want to adjustsImageWhenHighlighted to be NO?
Nevermind, I was told that the screenshot on the left is intended. Thanks! Marking resolved.
Image of the comment above
Thanks for answering! I have another question, In this code https://source.chromium.org/chromium/chromium/src/+/main:ios/chrome/browser/ui/autofill/form_input_accessory/branding_view_controller.mm;l=141?q=branding_view_controller, the image associated (the first logo above the keyboard) looks bigger. Would you happen to know possible reasons why the scaling would be different? I already checked the image scale and size and found that they were 3 and 24x24 respectively. So not sure why when using UIButtonConfiguration the scale looks like 3 but without UIButtonConfiguration the scale looks like 2 but says 3.
Also I'm having an issue with this code
UIButton *mixedButton = [UIButton buttonWithType:UIButtonTypeSystem];
[self updateButton:mixedButton withFloat:420];
mixedButton.configuration = [UIButtonConfiguration plainButtonConfiguration];
[mixedButton setImage:[UIImage imageNamed:@"Tweet"] forState:UIControlStateNormal];
mixedButton.tintColor = [UIColor redColor];
[self.view addSubview:mixedButton];
How come the tint color doesn't affect the image set when there's a configuration set? From what I read, old methods and properties should override configuration changes.
Even in this example of a sample project
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self.view setBackgroundColor:[UIColor whiteColor]];
UIButton *legacyButton = [[UIButton alloc] init];
[self updateButton:legacyButton withFloat:210];
[self.view addSubview:legacyButton];
UIButtonConfiguration* buttonConfiguration = [UIButtonConfiguration plainButtonConfiguration];
UIButton *configButton = [UIButton buttonWithConfiguration:buttonConfiguration primaryAction:nil];
[self updateButton:configButton withFloat:260];
[self.view addSubview:configButton];
UIButton *mixedButton = [[UIButton alloc] init];
[self updateButton:mixedButton withFloat:310];
mixedButton.configuration = [UIButtonConfiguration plainButtonConfiguration];
[self.view addSubview:mixedButton];
}
- (void) updateButton:(UIButton*)button withFloat: (CGFloat)yAxis {
button.titleLabel.font =
[[UIFont preferredFontForTextStyle:UIFontTextStyleHeadline]
fontWithSize:17.0];
[button setBackgroundColor:[UIColor blueColor]];
[button setTitle:@"Legacy" forState:UIControlStateNormal];
button.frame = CGRectMake(80.0, yAxis, 160.0, 40.0);
}
@end
You will notice that the UILabel doesn't respect the boundaries of the UIButton. Please help
Can we possibly remove the deprecation warning since UIButtonConfiguration doesn't have the full functionality required to migrate over from the legacy UIButton system? LineBreakMode wasn't even added until recently in iOS 16.
This issue isn't resolved, I just hit the solve button by accident and can't remove it
Here's a link to the code I'm trying to work with https://source.chromium.org/chromium/chromium/src/+/main:ios/chrome/browser/ui/price_notifications/cells/price_notifications_track_button.mm;l=26-61?q=price_notifications_track_button. Specifically, I'm trying to deprecate the legacy UIButton system and replace it with UIButtonConfiguration.