myTable、myMap作业代写、ViewController作业代写、Java/Python语言作业代做、c/c++,Python编程作业调试代做留学生P

Assignment 2 - Getting the User’s Actual LocationFor this assignment, I’ve suggested that you order the artworks in your table, by distance from theuser - an activity that is standard for an App that displays location based items. But how do youdetermine the user’s location (and how, in particular, do we do it in the simulator)?In your App, make sure that your table and map are installed on your storyboard for your mainview. Make sure that you control drag from the table to the View Controller yellow icon, and make adatasource and delegate. Do the same from the map (as a delegate).You’ll also need to control drag from the table and from the map to your view controller source andmake an outlet for each (myTable and myMap).Apps can’t just know where the user is located (it’s a potential intrusion on the user’s privacy), andso we have to request that the user allows iOS to tell us.Select the info.plist from the list of files on the left hand side. You will need to add two additionalitems to it. Hover over the up/down arrows by the final item, click the plus and then select “Privacy- Location When in Use Usage Description” and repeat this with “Privacy - Location Always UsageDescription”. Add a meaningful string describing why you need each of these.Now we need to update the ViewController to add protocols for the various types of delegation etc.that we will be adopting. Update your ViewController.swift file to show the following (you can findthe text further in this document):Xcode will alert you to the fact that you need to provide some methods for these - let it create thestubs for you. You’ll need to supply the code (see a little further in this document).We want to get CoreLocation to do stuff for us, so we add CoreLocation to the import list. We alsoimport the Ashton Building location document (see the “Set up a custom location” link on theCOMP228 web page).We need to setup CoreLocation so that it will start sending us location messages when the usermoves. We have to write some code to create a locationManager instance, and then set it up withsome reasonable default values. We then have to request the user let us get their location, and ifthey confirm it, we will get location messages passed to us (calling a method that we have tosupply). Here’s my full code from ViewController.swift.//// ViewController.swift// UsersLocation//// Created by Phil Jimmieson on 10/12/2018.// Copyright ? 2018 Phil Jimmieson. All rights reserved.//import UIKitimport MapKitimport CoreLocationclass ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, MKMapViewDelegate,CLLocationManagerDelegate { var locationManager = CLLocationManager() //create an instance to manage our the user’s location. @IBOutlet weak var myTable: UITableView! @IBOutlet weak var myMap: MKMapView! func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 1 } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = UITableViewCell(style: UITableViewCell.CellStyle.subtitle, reuseIdentifier: myCell) cell.textLabel?.text = testing cell.detailTextLabel?.text = more testing return cell } override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. locationManager.delegate = self as CLLocationManagerDelegate //we want messages about location locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation locationManager.requestWhenInUseAuthorization() //ask the user for permission to get their location locationManager.startUpdatingLocation() //and start receiving those messages (if we’re allowed to) } func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { let locationOfUser = locations[0] //get the first location (ignore any others) let latitude = locationOfUser.coordinate.latitude let longitude = locationOfUser.coordinate.longitude let latDelta: CLLocationDegrees = 0.002 let lonDelta: CLLocationDegrees = 0.002 let span = MKCoordinateSpan(latitudeDelta: latDelta, longitudeDelta: lonDelta) let location = CLLocationCoordinate2D(latitude: latitude, longitude: longitude) let region = MKCoordinateRegion(center: location, span: span) self.myMap.setRegion(region, animated: true) }}Don’t forget to set the Map properties correctly:Finally, you should alt-click on the name of the simulator you’re about to run this on (as you did in lab 8, tochoose the language) - this will open a panel where you can configure various run time options. Select theAshton building as the default location.You should now be able to run this App in the simulator and get prompted to permit it to know your location:If you click allow, the map should zoom in to the Ashton building.本团队核心人员组成主要包括BAT一线工程师,精通德英语!我们主要业务范围是代做编程大作业、课程设计等等。我们的方向领域:window编程 数值算法 AI人工智能 金融统计 计量分析 大数据 网络编程 WEB编程 通讯编程 游戏编程多媒体linux 外挂编程 程序API图像处理 嵌入式/单片机 数据库编程 控制台 进程与线程 网络安全 汇编语言 硬件编程 软件设计 工程标准规等。其中代写编程、代写程序、代写留学生程序作业语言或工具包括但不限于以下范围:C/C++/C#代写Java代写IT代写Python代写辅导编程作业Matlab代写Haskell代写Processing代写Linux环境搭建Rust代写Data Structure Assginment 数据结构代写MIPS代写Machine Learning 作业 代写Oracle/SQL/PostgreSQL/Pig 数据库代写/代做/辅导Web开发、网站开发、网站作业ASP.NET网站开发Finance Insurace Statistics统计、回归、迭代Prolog代写Computer Computational method代做因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:[email protected] 微信:codehelp QQ:99515681 或邮箱:[email protected] 微信:codehelp

你可能感兴趣的:(myTable、myMap作业代写、ViewController作业代写、Java/Python语言作业代做、c/c++,Python编程作业调试代做留学生P)