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;








-4















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.










share|improve this question



















  • 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

















-4















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.










share|improve this question



















  • 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













-4












-4








-4








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.










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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












  • 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












1 Answer
1






active

oldest

votes


















0














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)






share|improve this answer























  • 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











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
);



);













draft saved

draft discarded


















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









0














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)






share|improve this answer























  • 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















0














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)






share|improve this answer























  • 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













0












0








0







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)






share|improve this answer













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)







share|improve this answer












share|improve this answer



share|improve this answer










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

















  • 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



















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현