在iOS9.0上使用UIAlertController
时,我发现它太小了。
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];
答案 0 :(得分:0)
当我使用运行时来更改fontWithDescriptor:size:
的方法时,可能会导致问题。
+ (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;
}
}