2016-07-07 6 views
0

以下のようにfuncを呼び出そうとしていますが、loadImage()で何を書いて、呼び出すときに別のイメージ名で入力できるようにしてください。変数としてのイメージ名(Swift)

多くのおかげimageNameは、パラメータの名前で、Stringがタイプです

func loadImage(????){ 

     self.Picture.image = UIImage (named: "Ch1-4 new.jpg") 

       UIView.animateWithDuration(3.0, 
            delay: 0.0, 
            options: [], 
            animations : { 

            let message = "Picture.mp3" 
            let triggerTime = (Int64(NSEC_PER_SEC) * 1) 
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, triggerTime), dispatch_get_main_queue(), {() -> Void in 
             self.playMessageOpening(message) 
            }) 
            self.Picture.hidden=false 
            self.Picture.alpha=0.0; 
            self.Picture.alpha=1.0; 

      }, 
            completion: { finished in 
            print("Picutre done") 


     }) 
    } 

答えて

2
func loadImage(imageName: String) { 
    self.Picture.image = UIImage (named: imageName) 

    ... 
} 

the Apple docsの関数宣言の詳細。

関連する問題