[英]Align UIAlertAction Title to the Left
[alertAction setValue:[NSNumber numberWithInt:NSTextAlignmentLeft]
forKey:@"titleTextAlignment"];
UIAlertController
is an opaque class. UIAlertController
是一个不透明的类。 That kind of customization isn't supported. 不支持这种自定义。 If you want, you can try to roll your own, or find an open source alternative.
如果需要,您可以尝试自己动手,或找到开源替代方案。
I've tried hacking it by traversing the view hierarchy and finding labels, but it didn't seem to work. 我曾尝试通过遍历视图层次结构和查找标签来对其进行破解,但它似乎没有用。 I also tested with
UIAppearance
, but labels don't respond to alignment changes. 我还使用
UIAppearance
进行了UIAppearance
,但是标签不响应对齐方式更改。
My sample code (Swift) is on GitHub . 我的示例代码(Swift) 在GitHub上 。
Some open source alternatives: 一些开源替代品:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.