I have a problem with my app, look at this pic
Now I'm typing on textView , I want a way to resize the textview or move it to top or scrolling to the last where I'm typing please help
I saw many answers here but all not working with me , and this is the code when i tried one of the answers
import UIKit
class AddEditClassNoteViewController: UIViewController {
@IBOutlet var keyboardHeightLayoutConstraint: NSLayoutConstraint?
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
deinit {
NSNotificationCenter.defaultCenter().removeObserver(self)
}
@IBOutlet weak var noteTextBox: UITextView!
override func touchesBegan(touches: NSSet, withEvent event: UIEvent)
{
self.noteTextBox.resignFirstResponder()
}
func textFieldDidBeginEditing(textField: UITextField) {
animateViewMoving(true,moveValue: 100)
}
func textFieldDidEndEditing(textField: UITextField) {
animateViewMoving(false,moveValue: 100)
}
func animateViewMoving (up:Bool, moveValue :CGFloat){
var movementDuration:NSTimeInterval = 0.3
var movement:CGFloat = ( up ? -moveValue : moveValue)
UIView.beginAnimations( "animateView", context: nil)
UIView.setAnimationBeginsFromCurrentState(true)
UIView.setAnimationDuration(movementDuration )
self.view.frame = CGRectOffset(self.view.frame, 0, movement)
UIView.commitAnimations()
}
}
Im using Swift IOS 8