Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background color change is late, so it flashes from white to selected color #1534

Open
mladjan opened this issue Feb 10, 2024 · 0 comments
Open

Comments

@mladjan
Copy link

mladjan commented Feb 10, 2024

I have a graph which is part of my UIView subclass (looks like this):

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self setupUI];
    }
    return self;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    [self setupUI];
}

- (void)setupUI {
    // Create AAChartView instance
    _aaChartView = [[AAChartView alloc] init];
    _aaChartView.scrollEnabled = NO;
    _aaChartView.translatesAutoresizingMaskIntoConstraints = NO;
    [self addSubview:_aaChartView];
    
    // Add constraints to position and size _aaChartView within RBGraphView
    NSLayoutConstraint *topConstraint = [_aaChartView.topAnchor constraintEqualToAnchor:self.topAnchor];
    NSLayoutConstraint *bottomConstraint = [_aaChartView.bottomAnchor constraintEqualToAnchor:self.bottomAnchor];
    NSLayoutConstraint *leadingConstraint = [_aaChartView.leadingAnchor constraintEqualToAnchor:self.leadingAnchor];
    NSLayoutConstraint *trailingConstraint = [_aaChartView.trailingAnchor constraintEqualToAnchor:self.trailingAnchor];
    
    [NSLayoutConstraint activateConstraints:@[topConstraint, bottomConstraint, leadingConstraint, trailingConstraint]];
    
    
    AAChart *aaChart = AAChart.new
    .backgroundColorSet(@"#191923");
    
    AATitle *aaTitle = AATitle.new
    .textSet(@"");

    AAOptions *aaaOptions = AAOptions.new
    .chartSet(aaChart)
    .titleSet(aaTitle) ;

    
    [_aaChartView aa_drawChartWithOptions:aaaOptions];

}

It is added to ViewController in viewDidLoad:


 public override func viewDidLoad() {
        super.viewDidLoad()
        
        rbGraphView = RBGraphView()
        guard let rbGraphView = rbGraphView else {return}
        rbGraphView.translatesAutoresizingMaskIntoConstraints = false
        graphContentView.addSubview(rbGraphView)

// some auto layout constraints

}

The problem is that background color change is happening when the screen is shown, so it flashes from white to #191923

I can't add and draw it earlier then viewDidLoad.

Is there any way to make it earlier?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant