Passing location information from uibutton to a map view page and start navigatingDrawing a route in MapKit in iOSHow to restrict the google map view from panning beyond provided coordinate bounds?Not able to pass value from one View Controller to another View ControllerHow to embed GoogleMaps into mobile application for real-time navigation?how to display Single Location on mapview in iOs?Upload Map information to Firebase - iOS SwiftHow to draw a route between current location and destination within Mapkit Swift 3?My map draws a normal polyline along my route, but then draws another in a straight lineHow to draw UIBezierPath identical to MKPolyline in a UIViewCreate Map Image through Latitude and Longitude in ios swift4
Why is it bad to use your whole foot in rock climbing
In The Incredibles 2, why does Screenslaver's name use a pun on something that doesn't exist in the 1950s pastiche?
Should I email my professor to clear up a (possibly very irrelevant) awkward misunderstanding?
Is all-caps blackletter no longer taboo?
Can I get a photo of an Ancient Arrow?
How Many Times To Repeat An Event With Known Probability Before It Has Occurred A Number of Times
Interview was just a one hour panel. Got an offer the next day; do I accept or is this a red flag?
If statement with arcpy
What's the reason for the decade jump in the recent X-Men trilogy?
usage of mir gefallen
Background for black and white chart
Can Dive Down protect a creature against Pacifism?
Was the Lonely Mountain, where Smaug lived, a volcano?
Can Mage Hand be used to indirectly trigger an attack?
Is there a term for someone whose preferred policies are a mix of Left and Right?
How to search for Android apps without ads?
Harley Davidson clattering noise from engine, backfire and failure to start
How to represent jealousy in a cute way?
Placement of positioning lights on A320 winglets
Would a bit of grease on overhead door cables or bearings cause the springs to break?
Is it possible to have battery technology that can't be duplicated?
How to turn a table by 90° and split variables in two or more lines
Is it ethical to cite a reviewer's papers even if they are rather irrelevant?
Why are backslashes included in this shell script?
Passing location information from uibutton to a map view page and start navigating
Drawing a route in MapKit in iOSHow to restrict the google map view from panning beyond provided coordinate bounds?Not able to pass value from one View Controller to another View ControllerHow to embed GoogleMaps into mobile application for real-time navigation?how to display Single Location on mapview in iOs?Upload Map information to Firebase - iOS SwiftHow to draw a route between current location and destination within Mapkit Swift 3?My map draws a normal polyline along my route, but then draws another in a straight lineHow to draw UIBezierPath identical to MKPolyline in a UIViewCreate Map Image through Latitude and Longitude in ios swift4
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
enter image description here
var location: [Location] = [
Location(title: "LaFarge Hall", cllocation: CLLocation(latitude: 39.992853, longitude: -75.239888), regionRadius: 300.0, location: "Cardinal Ave", type: "Dorm Hall", coordinate: CLLocationCoordinate2DMake( 39.992853, -75.239888))
]
@IBAction func tapDidNavi(sender: UIButton)
I have a list of buttons which are drop - off locations places that users can choose from. When the user clicks the button, the button will move to the map view page and draw google polyliner path from the current location to the location that they select. Drop -off location buttons are in the array that includes the location coordinates, and I want to pass the location coordinates and start a map view that draws the path from the current location to the coordinates.
ios swift tableview
add a comment |
enter image description here
var location: [Location] = [
Location(title: "LaFarge Hall", cllocation: CLLocation(latitude: 39.992853, longitude: -75.239888), regionRadius: 300.0, location: "Cardinal Ave", type: "Dorm Hall", coordinate: CLLocationCoordinate2DMake( 39.992853, -75.239888))
]
@IBAction func tapDidNavi(sender: UIButton)
I have a list of buttons which are drop - off locations places that users can choose from. When the user clicks the button, the button will move to the map view page and draw google polyliner path from the current location to the location that they select. Drop -off location buttons are in the array that includes the location coordinates, and I want to pass the location coordinates and start a map view that draws the path from the current location to the coordinates.
ios swift tableview
1
Can you provide the source code of where these locations can be selected in your app?
– A. Welch
Mar 25 at 1:53
I just included in the source code.
– Greg Jones
Mar 25 at 14:01
@A.Welch i also included a link to a screenshot of my storyboard. There's a list of buttons, and I want to put these buttons in array which includes there location coordinates, and when the user clicks on the buttons; it would direct them to the map view page, and draw a path from the current location to the drop off location.
– Greg Jones
Mar 25 at 14:04
add a comment |
enter image description here
var location: [Location] = [
Location(title: "LaFarge Hall", cllocation: CLLocation(latitude: 39.992853, longitude: -75.239888), regionRadius: 300.0, location: "Cardinal Ave", type: "Dorm Hall", coordinate: CLLocationCoordinate2DMake( 39.992853, -75.239888))
]
@IBAction func tapDidNavi(sender: UIButton)
I have a list of buttons which are drop - off locations places that users can choose from. When the user clicks the button, the button will move to the map view page and draw google polyliner path from the current location to the location that they select. Drop -off location buttons are in the array that includes the location coordinates, and I want to pass the location coordinates and start a map view that draws the path from the current location to the coordinates.
ios swift tableview
enter image description here
var location: [Location] = [
Location(title: "LaFarge Hall", cllocation: CLLocation(latitude: 39.992853, longitude: -75.239888), regionRadius: 300.0, location: "Cardinal Ave", type: "Dorm Hall", coordinate: CLLocationCoordinate2DMake( 39.992853, -75.239888))
]
@IBAction func tapDidNavi(sender: UIButton)
I have a list of buttons which are drop - off locations places that users can choose from. When the user clicks the button, the button will move to the map view page and draw google polyliner path from the current location to the location that they select. Drop -off location buttons are in the array that includes the location coordinates, and I want to pass the location coordinates and start a map view that draws the path from the current location to the coordinates.
var location: [Location] = [
Location(title: "LaFarge Hall", cllocation: CLLocation(latitude: 39.992853, longitude: -75.239888), regionRadius: 300.0, location: "Cardinal Ave", type: "Dorm Hall", coordinate: CLLocationCoordinate2DMake( 39.992853, -75.239888))
]
@IBAction func tapDidNavi(sender: UIButton)
var location: [Location] = [
Location(title: "LaFarge Hall", cllocation: CLLocation(latitude: 39.992853, longitude: -75.239888), regionRadius: 300.0, location: "Cardinal Ave", type: "Dorm Hall", coordinate: CLLocationCoordinate2DMake( 39.992853, -75.239888))
]
@IBAction func tapDidNavi(sender: UIButton)
ios swift tableview
ios swift tableview
edited Mar 25 at 14:01
Greg Jones
asked Mar 25 at 1:28
Greg JonesGreg Jones
62
62
1
Can you provide the source code of where these locations can be selected in your app?
– A. Welch
Mar 25 at 1:53
I just included in the source code.
– Greg Jones
Mar 25 at 14:01
@A.Welch i also included a link to a screenshot of my storyboard. There's a list of buttons, and I want to put these buttons in array which includes there location coordinates, and when the user clicks on the buttons; it would direct them to the map view page, and draw a path from the current location to the drop off location.
– Greg Jones
Mar 25 at 14:04
add a comment |
1
Can you provide the source code of where these locations can be selected in your app?
– A. Welch
Mar 25 at 1:53
I just included in the source code.
– Greg Jones
Mar 25 at 14:01
@A.Welch i also included a link to a screenshot of my storyboard. There's a list of buttons, and I want to put these buttons in array which includes there location coordinates, and when the user clicks on the buttons; it would direct them to the map view page, and draw a path from the current location to the drop off location.
– Greg Jones
Mar 25 at 14:04
1
1
Can you provide the source code of where these locations can be selected in your app?
– A. Welch
Mar 25 at 1:53
Can you provide the source code of where these locations can be selected in your app?
– A. Welch
Mar 25 at 1:53
I just included in the source code.
– Greg Jones
Mar 25 at 14:01
I just included in the source code.
– Greg Jones
Mar 25 at 14:01
@A.Welch i also included a link to a screenshot of my storyboard. There's a list of buttons, and I want to put these buttons in array which includes there location coordinates, and when the user clicks on the buttons; it would direct them to the map view page, and draw a path from the current location to the drop off location.
– Greg Jones
Mar 25 at 14:04
@A.Welch i also included a link to a screenshot of my storyboard. There's a list of buttons, and I want to put these buttons in array which includes there location coordinates, and when the user clicks on the buttons; it would direct them to the map view page, and draw a path from the current location to the drop off location.
– Greg Jones
Mar 25 at 14:04
add a comment |
1 Answer
1
active
oldest
votes
I would suggest trying to use a UITableView here instead of a list of buttons. But if you need to use a list of buttons this should work:
Just create a subclass of UIButton and add a location property to its initializer.
class LocationButton: UIButton
public var location : Location
init(location: Location, frame: CGRect)
self.location = location
super.init(frame: frame)
setProperties()
///needed for interface builder
required init?(coder aDecoder: NSCoder)
fatalError("init(coder:) has not been implemented")
private func setProperties()
//Set properties of button here...
setTitle("Button Title", for: .normal)
Creating a 'LocationButton' will look similar to this:
let locationButton = LocationButton(location: Location(title: "LaFarge Hall", location: CLLocation(), frame: CGRect())
Make sure to also add a target to each button in the array:
locationButton.addTarget(self, action: #selector(tapDidNavi(_:)), for: .touchUpInside)
Update your tapDidNavi() function to accept a LocationButton type. Then you will be able to grab the location off any button pressed and pass it to the next viewController like so:
@IBAction func tapDidNavi(sender: LocationButton)
let nextViewController = SomeViewController() //This viewController must have a 'public var Location' inside of it.
nextViewController.location = sender.location //The location object you set on the button
self.navigationController?.pushViewController(nextViewController, animated: true)
how I am able to have the view controller which is the map view controller grab the location? In my map view controller I just have the properties var locationManager = CLocationManager()
– Greg Jones
Mar 31 at 23:02
when i type nextViewContrroller.location = sender.location it doesnt work
– Greg Jones
Mar 31 at 23:03
Add this property to your mapViewController: var location: Location!
– A. Welch
Mar 31 at 23:05
And switch “nextViewController” with the name of your mapViewController
– A. Welch
Mar 31 at 23:06
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55330250%2fpassing-location-information-from-uibutton-to-a-map-view-page-and-start-navigati%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I would suggest trying to use a UITableView here instead of a list of buttons. But if you need to use a list of buttons this should work:
Just create a subclass of UIButton and add a location property to its initializer.
class LocationButton: UIButton
public var location : Location
init(location: Location, frame: CGRect)
self.location = location
super.init(frame: frame)
setProperties()
///needed for interface builder
required init?(coder aDecoder: NSCoder)
fatalError("init(coder:) has not been implemented")
private func setProperties()
//Set properties of button here...
setTitle("Button Title", for: .normal)
Creating a 'LocationButton' will look similar to this:
let locationButton = LocationButton(location: Location(title: "LaFarge Hall", location: CLLocation(), frame: CGRect())
Make sure to also add a target to each button in the array:
locationButton.addTarget(self, action: #selector(tapDidNavi(_:)), for: .touchUpInside)
Update your tapDidNavi() function to accept a LocationButton type. Then you will be able to grab the location off any button pressed and pass it to the next viewController like so:
@IBAction func tapDidNavi(sender: LocationButton)
let nextViewController = SomeViewController() //This viewController must have a 'public var Location' inside of it.
nextViewController.location = sender.location //The location object you set on the button
self.navigationController?.pushViewController(nextViewController, animated: true)
how I am able to have the view controller which is the map view controller grab the location? In my map view controller I just have the properties var locationManager = CLocationManager()
– Greg Jones
Mar 31 at 23:02
when i type nextViewContrroller.location = sender.location it doesnt work
– Greg Jones
Mar 31 at 23:03
Add this property to your mapViewController: var location: Location!
– A. Welch
Mar 31 at 23:05
And switch “nextViewController” with the name of your mapViewController
– A. Welch
Mar 31 at 23:06
add a comment |
I would suggest trying to use a UITableView here instead of a list of buttons. But if you need to use a list of buttons this should work:
Just create a subclass of UIButton and add a location property to its initializer.
class LocationButton: UIButton
public var location : Location
init(location: Location, frame: CGRect)
self.location = location
super.init(frame: frame)
setProperties()
///needed for interface builder
required init?(coder aDecoder: NSCoder)
fatalError("init(coder:) has not been implemented")
private func setProperties()
//Set properties of button here...
setTitle("Button Title", for: .normal)
Creating a 'LocationButton' will look similar to this:
let locationButton = LocationButton(location: Location(title: "LaFarge Hall", location: CLLocation(), frame: CGRect())
Make sure to also add a target to each button in the array:
locationButton.addTarget(self, action: #selector(tapDidNavi(_:)), for: .touchUpInside)
Update your tapDidNavi() function to accept a LocationButton type. Then you will be able to grab the location off any button pressed and pass it to the next viewController like so:
@IBAction func tapDidNavi(sender: LocationButton)
let nextViewController = SomeViewController() //This viewController must have a 'public var Location' inside of it.
nextViewController.location = sender.location //The location object you set on the button
self.navigationController?.pushViewController(nextViewController, animated: true)
how I am able to have the view controller which is the map view controller grab the location? In my map view controller I just have the properties var locationManager = CLocationManager()
– Greg Jones
Mar 31 at 23:02
when i type nextViewContrroller.location = sender.location it doesnt work
– Greg Jones
Mar 31 at 23:03
Add this property to your mapViewController: var location: Location!
– A. Welch
Mar 31 at 23:05
And switch “nextViewController” with the name of your mapViewController
– A. Welch
Mar 31 at 23:06
add a comment |
I would suggest trying to use a UITableView here instead of a list of buttons. But if you need to use a list of buttons this should work:
Just create a subclass of UIButton and add a location property to its initializer.
class LocationButton: UIButton
public var location : Location
init(location: Location, frame: CGRect)
self.location = location
super.init(frame: frame)
setProperties()
///needed for interface builder
required init?(coder aDecoder: NSCoder)
fatalError("init(coder:) has not been implemented")
private func setProperties()
//Set properties of button here...
setTitle("Button Title", for: .normal)
Creating a 'LocationButton' will look similar to this:
let locationButton = LocationButton(location: Location(title: "LaFarge Hall", location: CLLocation(), frame: CGRect())
Make sure to also add a target to each button in the array:
locationButton.addTarget(self, action: #selector(tapDidNavi(_:)), for: .touchUpInside)
Update your tapDidNavi() function to accept a LocationButton type. Then you will be able to grab the location off any button pressed and pass it to the next viewController like so:
@IBAction func tapDidNavi(sender: LocationButton)
let nextViewController = SomeViewController() //This viewController must have a 'public var Location' inside of it.
nextViewController.location = sender.location //The location object you set on the button
self.navigationController?.pushViewController(nextViewController, animated: true)
I would suggest trying to use a UITableView here instead of a list of buttons. But if you need to use a list of buttons this should work:
Just create a subclass of UIButton and add a location property to its initializer.
class LocationButton: UIButton
public var location : Location
init(location: Location, frame: CGRect)
self.location = location
super.init(frame: frame)
setProperties()
///needed for interface builder
required init?(coder aDecoder: NSCoder)
fatalError("init(coder:) has not been implemented")
private func setProperties()
//Set properties of button here...
setTitle("Button Title", for: .normal)
Creating a 'LocationButton' will look similar to this:
let locationButton = LocationButton(location: Location(title: "LaFarge Hall", location: CLLocation(), frame: CGRect())
Make sure to also add a target to each button in the array:
locationButton.addTarget(self, action: #selector(tapDidNavi(_:)), for: .touchUpInside)
Update your tapDidNavi() function to accept a LocationButton type. Then you will be able to grab the location off any button pressed and pass it to the next viewController like so:
@IBAction func tapDidNavi(sender: LocationButton)
let nextViewController = SomeViewController() //This viewController must have a 'public var Location' inside of it.
nextViewController.location = sender.location //The location object you set on the button
self.navigationController?.pushViewController(nextViewController, animated: true)
answered Mar 26 at 2:40
A. WelchA. Welch
166115
166115
how I am able to have the view controller which is the map view controller grab the location? In my map view controller I just have the properties var locationManager = CLocationManager()
– Greg Jones
Mar 31 at 23:02
when i type nextViewContrroller.location = sender.location it doesnt work
– Greg Jones
Mar 31 at 23:03
Add this property to your mapViewController: var location: Location!
– A. Welch
Mar 31 at 23:05
And switch “nextViewController” with the name of your mapViewController
– A. Welch
Mar 31 at 23:06
add a comment |
how I am able to have the view controller which is the map view controller grab the location? In my map view controller I just have the properties var locationManager = CLocationManager()
– Greg Jones
Mar 31 at 23:02
when i type nextViewContrroller.location = sender.location it doesnt work
– Greg Jones
Mar 31 at 23:03
Add this property to your mapViewController: var location: Location!
– A. Welch
Mar 31 at 23:05
And switch “nextViewController” with the name of your mapViewController
– A. Welch
Mar 31 at 23:06
how I am able to have the view controller which is the map view controller grab the location? In my map view controller I just have the properties var locationManager = CLocationManager()
– Greg Jones
Mar 31 at 23:02
how I am able to have the view controller which is the map view controller grab the location? In my map view controller I just have the properties var locationManager = CLocationManager()
– Greg Jones
Mar 31 at 23:02
when i type nextViewContrroller.location = sender.location it doesnt work
– Greg Jones
Mar 31 at 23:03
when i type nextViewContrroller.location = sender.location it doesnt work
– Greg Jones
Mar 31 at 23:03
Add this property to your mapViewController: var location: Location!
– A. Welch
Mar 31 at 23:05
Add this property to your mapViewController: var location: Location!
– A. Welch
Mar 31 at 23:05
And switch “nextViewController” with the name of your mapViewController
– A. Welch
Mar 31 at 23:06
And switch “nextViewController” with the name of your mapViewController
– A. Welch
Mar 31 at 23:06
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55330250%2fpassing-location-information-from-uibutton-to-a-map-view-page-and-start-navigati%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Can you provide the source code of where these locations can be selected in your app?
– A. Welch
Mar 25 at 1:53
I just included in the source code.
– Greg Jones
Mar 25 at 14:01
@A.Welch i also included a link to a screenshot of my storyboard. There's a list of buttons, and I want to put these buttons in array which includes there location coordinates, and when the user clicks on the buttons; it would direct them to the map view page, and draw a path from the current location to the drop off location.
– Greg Jones
Mar 25 at 14:04