How to pass button title to next view controller in Swift
问题 I have several buttons defined in a loop in viewDidLoad. They are inside a content view, which is in a scroll view. for var i:Int = 0; i < colleges.count; i++ { let collegeButton = UIButton.buttonWithType(UIButtonType.System) as UIButton collegeButton.frame = CGRectMake(0, 0, self.contentView.frame.size.width, 30) collegeButton.center = CGPoint(x: self.contentView.center.x, y: 30 * CGFloat(i) + 30) collegeButton.setTitle(sortedColleges[i], forState: UIControlState.Normal) collegeButton