2

UIButton cityのテキストを変更したい。

しかし、うまくいきません。ここで何が問題なのか教えていただけますか? そして、この IBAction setUpCityDropDown は同じ UIButton に接続されています。

 @IBAction func setUpCityDropDown()
        {
            let ActionSheet =  UIAlertController(title: "Which City?", message: "City Name", preferredStyle: UIAlertControllerStyle.ActionSheet)

            let cancelActionButton: UIAlertAction = UIAlertAction(title: "Cancel", style: .Cancel) { action -> Void in
            }
            let delhiActionActionButton : UIAlertAction = UIAlertAction(title: "Delhi", style: UIAlertActionStyle.Default)
            {   action -> Void in


                self.city.setTitle("Delhi", forState:  UIControlState.Normal)
                self.city.sizeToFit()

            }
            let mumbaiActionActionButton : UIAlertAction = UIAlertAction(title: "Mumbai", style: UIAlertActionStyle.Default)
            {
                action -> Void in
                self.city.setTitle("Mumbai", forState:  UIControlState.Normal)

                self.city.sizeToFit()
            }
            let ahmedabadActionButton : UIAlertAction = UIAlertAction(title: "Ahmedabad", style: UIAlertActionStyle.Default)
            {
                action -> Void in
                self.city.setTitle("Ahmedabad", forState:  UIControlState.Normal)

                self.city.sizeToFit()
            }

            ActionSheet.addAction(cancelActionButton)
            ActionSheet.addAction(ahmedabadActionButton)
            ActionSheet.addAction(delhiActionActionButton)
            ActionSheet.addAction(mumbaiActionActionButton)
            self.presentViewController(ActionSheet, animated: true, completion: nil)
        }

    }

ここに画像の説明を入力

4

1 に答える 1