Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

iOS tintColor bug #6023

Closed
MillerApps opened this issue Aug 15, 2016 · 7 comments
Closed

iOS tintColor bug #6023

MillerApps opened this issue Aug 15, 2016 · 7 comments
Assignees
Labels
bug iOS Mapbox Maps SDK for iOS

Comments

@MillerApps
Copy link

MillerApps commented Aug 15, 2016

Hello I have an issue with the tintColor of all my UIButtons in the view hierarchy being set to the MGLMapView's tintColor. This only happens if I first present a UIAlertController and then tap one of the action buttons.

A little about my setup, I am using Swift 2.2 and setup the MGLMapView using StoryBoards.

Here is a short clip of what happens.

Platform: iOS
Mapbox SDK version: 3.3.4

Steps to trigger behavior

  1. Create a UIAlertController
  2. Display the UIAlertController
  3. Tap any of the action buttons

Expected behavior

The tintColor of UIButtons should remain the same after dismissing a UIAlertController.

Actual behavior

The tintColor for all UIButtons is set to the default of MGLMapView, upon dismissing a UIAlertController.

@incanus
Copy link
Contributor

incanus commented Aug 15, 2016

Are you doing anything in your own code with tintColor updating? Could you try setting a symbolic breakpoint on -updateTintColorForView: and see if it is called unexpectedly in our code?

@incanus incanus added bug iOS Mapbox Maps SDK for iOS labels Aug 15, 2016
@MillerApps
Copy link
Author

I set the tintColor for a few UIButtons in viewDidLoad. As for the breakpoint on -updateTintColorForView: it does not appear to be hit.

@incanus incanus self-assigned this Aug 15, 2016
@incanus
Copy link
Contributor

incanus commented Aug 15, 2016

Is the UIButton in question a subview of the MGLMapView?

@MillerApps
Copy link
Author

Yes.

@incanus
Copy link
Contributor

incanus commented Aug 16, 2016

Aha! Ok, so MGLMapView iterates its view hierarchy in order to change the tint color of subviews such as its attribution button, markers, polylines, and the like. I'm not sure of a good way that we can avoid also doing this for consumer views such as your buttons, other than explicitly naming the subviews that we put in and avoiding the rest, which is brittle.

Any ideas @1ec5? Maybe another approach might be to enumerate the subviews of MGLMapView at the first display, store those, and only change them in future?

@1ec5
Copy link
Contributor

1ec5 commented Aug 16, 2016

We certainly could update the tint color for only the subviews we create. However, if I'm not mistaken, the current behavior is consistent with any UIKit container view such as a UITableView or UIScrollView. I'll have to double-check that though.

In any case, the workaround is to set the tint color back to the desired color, or to subclass UIButton and override -setTintColor: to ignore any attempt to set the tint color to the map view's tint color.

@MillerApps
Copy link
Author

Thanks guys, great to see such fast and quality responses.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

No branches or pull requests

3 participants