首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >UIAlertController太小了

UIAlertController太小了
EN

Stack Overflow用户
提问于 2018-06-22 09:25:10
回答 1查看 126关注 0票数 0

当我在is 9.0上使用UIAlertController时,我发现它太小了。

代码语言:javascript
复制
UIAlertController * alertVC = [UIAlertController alertControllerWithTitle:@"title" message:@"XXXXXXXX" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction * cancelAction = [UIAlertAction actionWithTitle:@"cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {}];

UIAlertAction * sureAction = [UIAlertAction actionWithTitle:@"sure" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {}];
[alertVC addAction:cancelAction];
[alertVC addAction:sureAction];
[self presentViewController:alertVC animated:YES completion:nil];

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-06-23 01:31:09

当我使用运行时来更改fontWithDescriptor:size:的方法时,它可能会导致问题。

代码语言:javascript
复制
+ (void)load {
   Method newMethod = class_getClassMethod([self class],   @selector(adjustFontWithDescriptor:size:));
   Method method = class_getClassMethod([self class], @selector(fontWithDescriptor:size:));
method_exchangeImplementations(newMethod, method);
}
+ (UIFont *)adjustFontWithDescriptor:(UIFontDescriptor *)descriptor size:(CGFloat)fontSize{
   UIFont *newFont = nil;
   newFont = [UIFont adjustFontWithDescriptor:descriptor size:[UIFont adjustFontSize:fontSize]];
   return newFont;
}
+ (CGFloat)adjustFontSize:(CGFloat)fontSize{
   //return fontSize * [UIScreen mainScreen].bounds.size.width / 375;
   if (WIN_WIDTH==320) {
       return fontSize-2;
   }else if (WIN_WIDTH==375){
       return fontSize;
   }else{
      return fontSize+2;
   }
 }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50984815

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档