import UIKit
class Artist {
let songName: String;
let image: String;
let artistName: String;
let playURL: String;
init(songName: String, artistName: String, image: String, playURL: String) {
self.songName = songName;
self.artistName = artistName;
self.image = image;
self.playURL = playURL;
}
class func getArtist() -> Array<Artist>{
return [
Artist(songName: "22", artistName: "Taylor Swift", image: "http://i.ytimg.com/vi/AgFeZr5ptV8/maxresdefault.jpg", playURL: "https://www.youtube.com/watch?v=AgFeZr5ptV8"),
Artist(songName: "You'll remember me", artistName: "Keith Urban", image: "http://d29ci68ykuu27r.cloudfront.net/product/Look-Inside/covers/5118691.jpg", playURL: "https://www.youtube.com/watch?v=2en4ofkt1eo"),
Artist(songName: "Cop Car", artistName: "Keith Urban", image: "http://nashvillegab.typepad.com/.a/6a00e552403d2f883301a5115b3dae970c-500wi", playURL: "https://www.youtube.com/watch?v=aJAe5miXN_Y"),
Artist(songName: "Numb", artistName: "Linkin Park", image: "https://upload.wikimedia.org/wikipedia/en/b/b9/Linkin_Park_-_Numb_CD_cover.jpg", playURL: "https://www.youtube.com/watch?v=kXYiU_JCYtU")];
}
}
我正在尝试初学艺术家。我得到一个错误指向init方法的结束括号。
我正在使用getArtist()来获取我的UIViewController的艺术家,其中包含一个使用的表:
override func viewDidLoad() {
super.viewDidLoad();
println("CENTER TABLE LOADED");
artistItems = Artist.getArtist();
println("SIZE OF THE ARTIST IS\(artistItems.count)");
self.tableView.dataSource = self;
}
答案 0 :(得分:0)
重新启动笔记本电脑后,代码似乎运行正常。怪异