Thanks Nic, i will use this instead!

On Feb 18, 2013, at 12:38 PM, Nic Wise <[email protected]> wrote:

> Thanks for posting this, Iki, I was just doing something simlar the other day.
> 
> UIKeyboard.BoundsFromNotification has been deprecated, so you might
> want to use this:
> 
> if(notification != null)
> {
> RectangleF keyboardFrame = UIKeyboard.FrameEndFromNotification(notification);
> animationDuration = 
> UIKeyboard.AnimationDurationFromNotification(notification);
> 
> if(notification.Name == UIKeyboard.WillShowNotification ||
> notification.Name == UIKeyboard.DidShowNotification)
> {
> if(IsPortrate(orientation))
> keyboardHeight = keyboardFrame.Size.Height;
> else
> keyboardHeight = keyboardFrame.Size.Width;
> } else
> 
> keyboardHeight = 0;
> 
> } else {
> keyboardHeight = VisibleKeyboardHeight;
> }
> 
> The FrameEndFromNotifiation is where the keyboard is when the animation ends.
> 
> 
> 
> On 17 February 2013 09:50, Iki <[email protected]> wrote:
>> Hello everyone, i have found solution, and quite elegant one. It was on my
>> table the whole time :), inside of a book, Professional iPhone Programming
>> with MonoTouch and .NET/C# by Wallace B McClure, Martin Bowling, Craig Dunn,
>> Chris Hardy and Rory Blyth.
>> 
>> So i hope this may help someone, i have found couple solutions on the net
>> but they all have some kind  of problems …
>> 
>> So i have UITextView, and the following code in my UIViewController.
>> 
>> 
>> NSObject observer1, observer2;
>> 
>> //++++ViewDidLoad++++
>> //Observing Keyboard
>> notifications-------------------------------------------
>> //WillShow
>> observer1 = NSNotificationCenter
>> .DefaultCenter
>> .AddObserver
>> (
>> UIKeyboard.WillShowNotification
>> ,delegate(NSNotification obj)
>> {
>> var kbdRect = UIKeyboard.BoundsFromNotification(obj);
>> var frame = textView.Frame;
>> frame.Height -= kbdRect.Height;
>> textView.Frame = frame;
>> }
>> );
>> //WillHide
>> observer2 = NSNotificationCenter
>> .DefaultCenter
>> .AddObserver
>> (
>> UIKeyboard.WillHideNotification
>> ,delegate(NSNotification obj)
>> {
>> var kbdRect = UIKeyboard.BoundsFromNotification(obj);
>> var frame = textView.Frame;
>> frame.Height += kbdRect.Height;
>> textView.Frame = frame;
>> 
>> 
>> }
>> );
>> //---------------------------------------------------------------------------
>> 
>> //++++ViewDidUnload++++ (apparently this is only necessary for iOS versions
>> < 6.0)
>> //Unsubscribing from observers------------------------------
>> NSNotificationCenter.DefaultCenter.RemoveObserver(observer1);
>> NSNotificationCenter.DefaultCenter.RemoveObserver(observer1);
>> //----------------------------------------------------------
>> 
>> 
>> 
>> 
>> On Feb 15, 2013, at 1:13 PM, Iki <[email protected]> wrote:
>> 
>> Hi guys,
>> 
>> the problem is:
>> 
>> I have UITextView, stretched trough whole screen. When typing eventually
>> text will go behind the keyboard, and the only way for me to scroll it is to
>> press return 20 times or so.
>> Is there any way to accomplish this manually, so that the TextView scroll
>> automatically as i type?
>> 
>> Thanks for any help guys/gals!
>> 
>> 
>> 
>> 
>> _______________________________________________
>> MonoTouch mailing list
>> [email protected]
>> http://lists.ximian.com/mailman/listinfo/monotouch
>> 
> 
> 
> 
> --
> Nic Wise
> t.  +44 7788 592 806 | @fastchicken
> b. http://www.fastchicken.co.nz/

_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to