옵션 |
|
import UIKit
class ViewController: UIViewController ,UIPickerViewDelegate {
let MAX_ARRAY_NUM = 7
let PICKER_VIEW_COLUN = 1
let PICKER_VIEW_HEIGHT : CGFloat = 120
var imageArray = [UIImage]()
var imageFileName = ["그린각_013-638-0569(5569)","마시내탕수육_031-636-5753(637-4770)","맛쓰리_031-637-4777","매일만나_031-633-9190","브리또_031-637-9497","사쿠사쿠_031-634-7765","일석_031-637-2343"]
@IBOutlet weak var pickerImage: UIPickerView!
@IBOutlet weak var lblImageFileName: UILabel!
@IBOutlet weak var imageView: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
for i in 0 ..< MAX_ARRAY_NUM {
let image = UIImage(named : imageFileName[i])
imageArray.append(image!)*여기서
Thread: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP,subcode=0x0) 이라는 오류가 납니다!!
}
lblImageFileName.text = imageFileName[0]
imageView.image = imageArray[0]
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return PICKER_VIEW_COLUN
}
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return imageFileName.count
}
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
lblImageFileName.text = imageFileName[row]
}
func pickerView(_ pickerView: UIPickerView, rowHeightForComponent component: Int) -> CGFloat {
return PICKER_VIEW_HEIGHT
}
}
혹시 몰라서 소스코드 전부를 올렸는데요
이 문제에 대해 검색해도 너무 원문수준의 글이 나와서 (영어까막눈) ㅠㅠㅠ
고생중인데 당최 문제가 뭔지 모르겠네요
심지어 예제를 그대로 가져다 써도 같은 오류가 납니다 혹시 무슨 문제인지 아시는분계씬가요?