watsonbox / ios_google_places_autocomplete

Google Places address entry for iOS (Swift)
MIT License
269 stars 69 forks source link

Present the xib from a UITableViewCell #43

Open perteadrian opened 8 years ago

perteadrian commented 8 years ago

Hi. I want to present the view directly when the users taps on a UITableViewCell.(Not presenting an UIViewController that presents the xib. like this the animation seems to be broken.)My UITableView is in a NavigationBar so if I can push the view instead of o modal show so I can have a back buttin instead of the close one. This is what I have in my storyboard: screen shot 2016-08-31 at 15 50 25 And this is the code:

import UIKit

class GPAViewController: GooglePlacesAutocomplete {

    override func viewDidLoad() {
        super.viewDidLoad()
        self.placeDelegate = self
        GPAViewController(apiKey: "MY API Key", placeType: .Cities)

    }
    override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(animated)

    }

}

extension GPAViewController: GooglePlacesAutocompleteDelegate {
    func placeSelected(place: Place) {
        print(place)
        let main = stb.instantiateViewControllerWithIdentifier("Menu")
        presentViewController(main, animated: true, completion: nil)

    }

    func placeViewClosed() {
        dismissViewControllerAnimated(false, completion: nil)
    }
}