我是Swift的新手,我遵循了这个教程:http://www.raywenderlich.com/90971/introduction-mapkit-swift-关于MapKit的教程.问题是我在这行代码上遇到了错误
let placemark = MKPlacemark(coordinate: self.coordinate, addressDictionary: addressDict)
Run Code Online (Sandbox Code Playgroud)
标题上描述了错误.包含此行的方法是:
func mapItem() -> MKMapItem {
let addressDict = [String(kABPersonAddressStreetKey): self.subtitle]
let placemark = MKPlacemark(coordinate: self.coordinate, addressDictionary: addressDict)
let mapItem = MKMapItem(placemark: placemark)
mapItem.name = self.title
return mapItem
}
Run Code Online (Sandbox Code Playgroud)
请帮忙.
我在swift中遵循了Ray Wenderlich MapKit教程:http://www.raywenderlich.com/90971/introduction-mapkit-swift-tutorial ,当我创建Artwork类时,我得到了标题中写的错误.我不知道自己要做什么.这是代码:
class Artwork: NSObject, MKAnnotation {
let title: String
let locationName: String
let discipline: String
let coordinate: CLLocationCoordinate2D
init(title: String, locationName: String, discipline: String, coordinate: CLLocationCoordinate2D) {
self.title = title
self.locationName = locationName
self.discipline = discipline
self.coordinate = coordinate
super.init()
}
}
Run Code Online (Sandbox Code Playgroud)
请帮忙!
我在Swift中有这行代码:
let graphPoints:[Int] = [4, 2, 6, 4, 5, 8, 3]
let average = graphPoints.reduce(0, combine: +) / graphPoints.count
Run Code Online (Sandbox Code Playgroud)
可以在目标c代码中"翻译"这行代码吗?
对于我来说,减少组合概念的工作原理并不是很清楚.我读过它但仍不清楚.
我从本教程中获取了代码:http://www.raywenderlich.com/90693/modern-core-graphics-with-swift-part-2
请帮忙.谢谢.
我有这行代码:
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:nil preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:cancelTitle style:UIAlertActionStyleCancel handler:^(UIAlertAction * action) {
NSLog(@"cancel registration");
}];
[alertController addAction:cancelAction];
alertController.view.tintColor = [UIColor redColor];
Run Code Online (Sandbox Code Playgroud)
我想在选择时更改取消按钮颜色.我怎样才能做到这一点?请帮忙.