ios - Textfield not working once clicked on in the simulator -
i using google maps sdk , have map route user wherever specific location. user able input want go, rather being routed same location. added text field gui , whenever run app in simulator , click textfield, no keyboard comes , acts though did not tap on it.
here how have set project:
import uikit import googlemaps import googleplaces import coredata class viewcontroller: uiviewcontroller, cllocationmanagerdelegate, uitextfielddelegate { let locationmanager = cllocationmanager() var currlocation: cllocationcoordinate2d! var keyy = "mykeyishere" var didfindmylocation = false var count: int = 0 var button = uibutton() var latitude = uitextfield() var longitude = uitextfield() var path = gmsmutablepath() super.viewdidload() let blah = gmscameraposition.camera(withlatitude: 39.8282, longitude: -98.5795, zoom: 25.0) mapview.camera = blah locationmanager.delegate = self locationmanager.requestwheninuseauthorization() mapview.addobserver(self, forkeypath: "mylocation", options: nskeyvalueobservingoptions.new, context: nil) currlocation = mapview.mylocation?.coordinate button = uibutton(type: .system) button.frame = cgrect(x: 135, y: 40, width: 100, height: 40) button.backgroundcolor = uicolor.clear button.layer.cornerradius = 5 button.layer.borderwidth = 1 button.layer.bordercolor = uicolor.blue.cgcolor button.settitle("route", for: uicontrolstate.normal) button.addtarget(self, action: #selector(viewcontroller.buttonpressed), for: uicontrolevents.touchupinside) latitude = uitextfield() latitude.frame = cgrect(x: 5, y: 90, width: 175, height: 35) latitude.backgroundcolor = uicolor.white latitude.layer.cornerradius = 5 latitude.layer.borderwidth = 1 latitude.layer.bordercolor = uicolor.black.cgcolor latitude.isuserinteractionenabled = true latitude.text = " enter latitude" latitude.keyboardtype = uikeyboardtype.numbersandpunctuation self.latitude.delegate = self longitude = uitextfield() longitude.frame = cgrect(x: 195, y: 90, width: 175, height: 35) longitude.backgroundcolor = uicolor.white longitude.layer.cornerradius = 5 longitude.layer.borderwidth = 1 longitude.layer.bordercolor = uicolor.black.cgcolor longitude.isuserinteractionenabled = true longitude.text = " enter longitude" longitude.keyboardtype = uikeyboardtype.numbersandpunctuation self.longitude.delegate = self self.view.addsubview(latitude) self.view.addsubview(button) self.view.addsubview(longitude) } there more feel relevant problem. ive added 2 text fields here, , neither work! please help!
you able type in textfield using macs keyboard. if want keyboard show press cmd + k in simulator toggle software keyboard.
the keyboard show on device.
Comments
Post a Comment