2016-08-19 8 views
0

私は幸運にも実行するために私の迅速なコードでピッカービューを使用しようとしています。しかし、私がプログラムをロードするたびに、ピッカーのビューはそれ自身のゴーストイメージを作成します。なぜそれが起こるのですか?コードを調整する必要がありますか? hereUIPickerViewゴーストイメージ

import Foundation 
import UIKit 

class ViewTwo: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource { 

    @IBOutlet weak var pickerMenSplit: UIPickerView! 

    //var menPickerSplit: [String] = [String]() 
    var menPickerSplit = ["A", "B", "C", "D", "E"] 
    override func viewDidLoad() { 
     super.viewDidLoad() 
     // Do any additional setup after loading the view, typically from a nib. 

     //Connect Data: 
     pickerMenSplit.delegate = self 
     pickerMenSplit.dataSource = self 

     //Input data into the Array: 


    } 

    override func didReceiveMemoryWarning() { 
     super.didReceiveMemoryWarning() 
     // Dispose of any resources that can be recreated. 
    } 
    //the number of columns of data 
    func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int { 
     return 1 
    } 

    //the number of rows of data 
    func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { 
     return menPickerSplit.count 
    } 

    //the data to return for the row and component (column) that's being passed in 
    func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? { 
     return menPickerSplit[row] 
    } 

} 

答えて

0

プロジェクトを掃除しようとしたことがありますか? cmd + shift + k、それがうまくいかない場合は、シミュレータからあなたのアプリを削除してからもう一度実行してみてください。

+0

私はクリーンアップを行い、それは役に立たなかった。私は完全に新しいファイルでアプリケーションを実行しようとしたが、元のViewControllerのナビゲーションペインでは正常に動作することに気がつきましたが、新しいクラスで2つ目のナビゲーションペインを作成した場合、私は問題が何であるかはわかりませんが、2番目と3番目のView Controllerでピッカーにこれらのゴーストイメージを作成する理由を理解しようとしています。 – Phantomgrahf

+0

これをどのように修正できるか考えている人はいますか? – Phantomgrahf