I searched the web but could not find an acceptable solution to my problem. So, basically I have a UITextView in my project and I want the user to only be able to put in 2 lines of text. If the text has reached the 2 lines than it should not let the user put in anything more. (Exactly like in Snapchat but with 2 lines instead of one). I have some code which basically does what I want but instead of stopping the user from putting in more text it just puts periods to the end of the text.
self.textView.textContainer.maximumNumberOfLines = 2;
self.textView.textContainer.lineBreakMode = NSLineBreakByTruncatingTail;
I thought that maybe there is an option to achieve this in the NSLineBreakBy object but unfortunately there is not.
Any ideas on how could I do this?