iOS 7 UIRefreshControl tintColor not working for beginRefreshing

前端 未结 19 1586
我在风中等你
我在风中等你 2020-12-04 13:48

I\'m trying to set a tintColor on my UIRefreshControl (building on iOS 7). I enabled refreshing for the tableViewController in storyboard, then in my ViewController vi

相关标签:
19条回答
  • 2020-12-04 14:47

    I am working with Xamarin C# (iOS 10) and found that a combination of all of these answers is what fixed it for me.

    In my ViewDidLoad I have the following:

        RefreshControl = new UIRefreshControl();
        RefreshControl.TintColor = UIColor.White;
        RefreshControl.ValueChanged += OnRefresh;
        RefreshControl.BackgroundColor = UIColor.Clear;
    

    And later I programmatically call the refresh animation in my ViewDidAppear with the following:

        BeginInvokeOnMainThread(() =>
        {
            UIView.Animate(0, 0.2, UIViewAnimationOptions.BeginFromCurrentState, () =>
            {
                TableView.SetContentOffset(new CGPoint(0, TableView.ContentOffset.Y - RefreshControl.Frame.Size.Height), true);
                RefreshControl.AttributedTitle = new NSAttributedString("");
            },
            () =>
            {
                RefreshControl.BeginRefreshing();
            });
        });
    

    Note the setting of the attributed title and animation block were the parts I was missing for my RefreshControl to take my white tint color.

    Thanks to all that have contributed to this question.

    0 讨论(0)
提交回复
热议问题