Lenin
Lenin

Reputation: 685

Cancel button can't shown in GMSAutocompleteViewController

I added the autocomplete UI control "Add a full-screen control" from

https://developers.google.com/places/ios-api/autocomplete

and use the below code for presenting the Autocomplete view controller when the button is pressed.

let autocompleteController = GMSAutocompleteViewController()
autocompleteController.delegate = self
present(autocompleteController, animated: true, completion: nil)

The below images show what I have got. Everything is working, But cancel button is only shown when I click there.

enter image description here enter image description here

Upvotes: 1

Views: 409

Answers (1)

Vignesh M
Vignesh M

Reputation: 36

if you are using following type code then you are face this problem

UIBarButtonItem.appearance().setTitleTextAttributes([
        NSAttributedStringKey.foregroundColor: UIColor.white,
        NSAttributedStringKey.font: UIFont.systemFont(ofSize: 0.1)
    ], for: UIControlState.normal)

Solution - Change UIControlState from UIControlState.normal

UIBarButtonItem.appearance().setTitleTextAttributes([
        NSAttributedStringKey.foregroundColor : UIColor.white,
        NSAttributedStringKey.font: UIFont.systemFont(ofSize: 0.1)
    ], for: UIControlState.application)

Upvotes: 2

Related Questions