是否有RealmRecyclerViewAdapter的文档(除了代码本身 - 遵循下面给出的链接)?
在the example中,我发现只有这个适配器声明。
答案 0 :(得分:0)
所有关于你可以在official documentation中找到的领域(对Android平台来说也是有趣的东西)。
有关RealmRecyclerViewAdapter
的所有文档都是example,您找到了。
将您的知识从RealmRecyclerViewAdapter
推断为import UIKit
import MapKit
class FirstEventCell: UITableViewCell {
@IBOutlet weak var eventLocation: UILabel!
@IBAction func goToMaps(_ sender: UIButton) {
CLGeocoder().geocodeAddressString((eventLocation?.text)!, completionHandler: {(placemarks, error) in
if error != nil {
print("")
} else if placemarks!.count > 0 {
let placemark = placemarks![0]
let location = placemark.location
let coords = location!.coordinate
let coordinate = CLLocationCoordinate2DMake(coords.latitude,coords.longitude)
let mapItem = MKMapItem(placemark: MKPlacemark(coordinate: coordinate, addressDictionary:nil))
mapItem.name = "Target location"
mapItem.openInMaps(launchOptions: [MKLaunchOptionsDirectionsModeKey : MKLaunchOptionsDirectionsModeDriving])
}
})
}
}
class EventsTableTableViewController: UITableViewController {
var locations = ["Washington, DC 20565", "1600 Pennsylvania Ave NW, Washington, DC 20500", "East Capitol St NE & First St SE, Washington, DC 20004"]
override func viewDidLoad() {
super.viewDidLoad()
}
override func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return locations.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "firstCell", for: indexPath)
let eventLocation = locations[indexPath.row]
if let eventCell = cell as? FirstEventCell {
eventCell.eventLocation.text = eventLocation
}
return cell
}
并具有创造性 - 您将获得成功! :)