//ScrollView - TextField

//1. Add a scroll view to the storyboard //2. Add a textfield to the scroll view and make an outlet //3. Make the textfield a delegate (click and drag to the top of view – yellow icon). //4. in class header add comma (,) UITextFieldDelegate //5. Make sure you have made an outlet for your scrollview //6. Add delegate method textFielddidbeginediting and following code scrollView.setContentOffset(CGPointMake(0,250,),animated: true) //Could add if statement to test which textfield is being clicked and raise scroll accordingly if(textField==textOutlet){ } //7. Add method for handling when we click return button func textFieldShouldReturn(textField: UITextField)→ Bool( textField.resignFirstResponder() Return true } //8. Add another method textFieldDidEndEditing(textField)UITextfield){ scrollView.setContentOffset(CGPointMake(0,0,),animated: true) } //9. Put following into ViewDid Load var myTap=UITapGestureRecognizer() myTap=UITapGestureRecognizer(target: self, action:Selector( "dismissKeyboard")) view.addGestureRecognizer(myTap) //10. And include following method func dismissKeyboard(){ println("Touch") textF.resignFirstResponder() textf2.resignFirstResponder() }