0
私は最終的な結果のジョブリスト配列を外枠で使用したいと考えています。私はジョブリスト配列を使ってテーブルビューをセットアップしたいからです。 。swift3サイドクロージャーで配列を取得
let geoCoder = CLGeocoder()
geoCoder.geocodeAddressString(address) { (placemarks, error) in
if error == nil && (placemarks?.count)! > 0 {
let location2 = placemarks?[0].location
if let location1 = self.locationManager?.location {
let distanceInMeters = location1.distance(from: location2!)
let IntDis = Int(distanceInMeters)
//print(IntDis)
if IntDis < 40000 {
//print(address)
if let activityid = infoDictionary["ActivityID"] {self.newJob.ActivityID=activityid}
if let companyname = infoDictionary["CompanyName"] {self.newJob.CompanyName=companyname}
if let quantity = infoDictionary["Quantity"] {self.newJob.Quantity=quantity}
if let coupontitle = infoDictionary["Title"] {self.newJob.CouponTitle=coupontitle}
if let couponterms = infoDictionary["Terms"] {self.newJob.CouponTerms=couponterms}
if let expirdate = infoDictionary["ExpirDate"] {self.newJob.ExpirDate=expirdate}
if let contactperson = infoDictionary["ContactPerson"] {self.newJob.ContactPerson=contactperson}
if let tel = infoDictionary["TEL"] {self.newJob.TEL=tel}
self.joblist.append(self.newJob)
//print(self.joblist)
//self.tableView.reloadData()
}
}
}
}
あなたが言ったことによります。あなたは、レコードがテーブルビューに追加されるたびに、Tableviewが開始時に空のレコードを表示し、テーブルビューを再ロードし続けることを意味しますか? –
私はそうだと思います、上に掲示された私の答えはあなたのために働くのですか? – Eric
リロードを維持することは良い考えではありません。なぜなら、行の数が10を超える可能性があるからです。これは10回以上リロードし続けます。これが私のやり方です。そのため、配列の更新が完了した後にテーブルビューをリロードするように改善したいのです。 –