小编Gla*_*vid的帖子

iOS UINavigationBar色调颜色比颜色设置更暗

我正在为特定的导航控制器设置自定义外观:

//Set Cutom Nav Bar Appearance
[[UINavigationBar appearanceWhenContainedIn:[MyNavigationControllerClass class], nil] setBackgroundImage: nil forBarMetrics: UIBarMetricsDefault];
[[UINavigationBar appearanceWhenContainedIn:[MyNavigationControllerClass class], nil] setBarTintColor: self.tableView.backgroundColor];
Run Code Online (Sandbox Code Playgroud)

当显示导航控制器时,预期的颜色是RGB(247,247,247) - 我已经双重检查也是设置值时tableView.background颜色的值 - 但它在屏幕上显示为RGB(227 ,227,227).UINavigationBar的外观代理是否有不同的属性可以改变屏幕上显示的颜色?

谢谢!

编辑:

此外,如果我使用所需的颜色直接设置barTintColor,屏幕上显示的barTintColor仍然比预期更暗:

UIColor* navBarBackgroundColor = [UIColor colorWithRed: (247.0 / 255.0) green: (247.0 / 255.0) blue: (247.0 / 255.0) alpha: 1];
//Set Cutom Nav Bar Appearance
[[UINavigationBar appearanceWhenContainedIn:[MyNavigationControllerClass class], nil] setBackgroundImage: nil forBarMetrics: UIBarMetricsDefault];
[[UINavigationBar appearanceWhenContainedIn:[MyNavigationControllerClass class], nil] setBarTintColor: navBarBackgroundColor];
Run Code Online (Sandbox Code Playgroud)

以下是来自@Matt答案的解决方案代码.希望它可以帮助别人

CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext(); …
Run Code Online (Sandbox Code Playgroud)

colors uinavigationbar ios

7
推荐指数
1
解决办法
2550
查看次数

UIFeedbackGenerator _autoDeactivate崩溃iOS 11.2.2

我看到iOS 11中的触觉反馈引擎出现间歇性崩溃.不幸的是,我没有可重复的步骤,因为它似乎是随机发生的.

以下是异常和堆栈跟踪:

在自动停用<UIImpactFeedbackGenerator时引发异常:0x1c850a710:prepared = 0>对于样式2:强制停用<UIImpactFeedbackGenerator:0x1c850a710:prepared = 0>,样式为TurnOn且未激活(activationCount = -1)配置:<_UIImpactFeedbackGeneratorConfiguration:0x1c80bc920: isEnabled = 1,activationStyle = 2,requiredSupportLevel = 2> activationCount:-1,styleActivationCount:-1 engines:{(<_ UIFeedbackHapticOnlyEngine:0x1c80db040:state = 4,numberOfClients = 1,prewarmCount = 0,_isSuspended = 0>)}

# Platform: ios
# Application: MyApp
# Version: 3.1.0.4
# Bundle Identifier: com.company.myApp
# Issue #: 8845
# Issue ID: 59ff154761b02d480dd20c28
# Session ID: 2ec9b043edaa4fcaad12fa480d690e8a_0c4f8c61fbbd11e7924356847afe9799_0_v2
# Date: 2018-01-17T19:31:00Z
# OS Version: 11.2.2 (15C202)
# Device: iPhone 8
# RAM Free: 20.8%
# Disk Free: 82.9%

#0. Crashed: com.twitter.crashlytics.ios.exception
0  MyApp                  0x100d02fb8 CLSProcessRecordAllThreads …

ios haptic-feedback ios11

7
推荐指数
0
解决办法
904
查看次数

5
推荐指数
1
解决办法
990
查看次数

在tableView中的UITableViewHeaderFooterView中垂直居中textLabel:willDisplayHeaderView:forSection:

我试图垂直居中tableViewHeader的文本标签.这是相关的代码- (void) tableView: (UITableView*) tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section:

- (void) tableView: (UITableView*) tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section
{
    if(![view isKindOfClass:[UITableViewHeaderFooterView class]]){
        return;
    }

    UITableViewHeaderFooterView *tableViewHeaderFooterView = (UITableViewHeaderFooterView *) view;
    UILabel* label = tableViewHeaderFooterView.textLabel;

    label.textAlignment = NSTextAlignmentCenter;
    label.font = [UIFont rev_lightAppFontOfSize: 24.0f];
    label.textColor = [UIColor rev_colorWithHex: 0x858585];
    label.text = [label.text capitalizedString];

    label.center = tableViewHeaderFooterView.center; // label not in superview yet

    tableViewHeaderFooterView.layer.borderColor = [UIColor greenColor].CGColor;
    tableViewHeaderFooterView.layer.borderWidth = 2.0f;

    tableViewHeaderFooterView.contentView.layer.borderColor = [UIColor purpleColor].CGColor;
    tableViewHeaderFooterView.contentView.layer.borderWidth = 2.0f;

    label.layer.borderColor = [UIColor orangeColor].CGColor;
    label.layer.borderWidth = 2.0f; …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c uitableview ios

4
推荐指数
1
解决办法
8194
查看次数