あなたはUIImageView
のhighlightedImage
とisHighlighted
プロパティを使用してこれを行います。そして、あなたはviewDidLoad
方法では、単一のIBAction
を使用してこれを行うことができます。
yourImageView.image = UIImage(name:"RecordImage/TriggerImage")
yourImageView.highlightedImage = UIImage(name:"StopImage")
あなたはあまりにもインターフェイスビルダーでこれらの画像を設定することができます。次の画像でわかるように、Image
とHighlighted
の両方のプロパティの画像を設定する必要があります。 - チェックされている場合は、ボタン
の状態を確認するためのViewControllerクラスのプロパティを宣言= //真の記録が起こっている
yourImageView.isHighlighted = !yourImageView.isHighlighted
if yourImageView.isHighlighted
{
//so now the UIImageView shows stop image that means we are in recording mode
// do the actions that are to be done in recording mode like start recording updating other UI etc
}
else
{
//so now the UIImageView shows Record/Trigger image that means are in normal mode or not recording
// do the actions that are to be done in normal mode like stop recording (if required)updating other UI etc
}
以下のようにそのボタンのアクションを割り当てます。 –