ios – UIActionSheetUIAlertController多行文本

ios – UIActionSheetUIAlertController多行文本,第1张

概述这是我写的代码,用于显示UIActionSheet. actionSheet = [[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"updateresponseforrecurring", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) de 这是我写的代码,用于显示UIActionSheet.

actionSheet = [[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"updateresponseforrecurring",nil) delegate:self cancelbuttonTitle:NSLocalizedString(@"Cancel",nil) destructivebuttonTitle:nil otherbuttonTitles:                   NSLocalizedString(@"updateresponSEOnlyforthis",nil),NSLocalizedString(@"updateresponseforallactivitIEs",nil];    actionSheet.tag = 2;    [actionSheet showInVIEw:[UIApplication sharedApplication].keyWindow];

这就是我使用它:

显然,第二种选择更长,因此尺寸变小以适应宽度.
但我希望所有选项都使用相同的字体大小,这样我就可以使用多行.也尝试使用UIAlertController,但无法设置多行文本.
怎么做到这一点?

解决方法 这似乎适用于iOS 10和Swift 3.1:

UILabel.appearance(whenContainedInInstancesOf: [UIAlertController.self]).numberOflines = 2
总结

以上是内存溢出为你收集整理的ios – UIActionSheet / UIAlertController多行文本全部内容,希望文章能够帮你解决ios – UIActionSheet / UIAlertController多行文本所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1209387.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-04
下一篇2022-06-04

发表评论

登录后才能评论

评论列表(0条)

    保存