Ok super this explains everything, thanks again!

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

> The animation duration is how long the keyboard takes from being
> invisible to being visible. The code I took it from:
> 
> https://github.com/nicwise/BTProgressHUD
> 
> Needs to move it's view at the same speed as the keyboard comes up,
> rather than waiting for it to finish, then moving it in one go.
> 
> On 19 February 2013 11:01, Iki <[email protected]> wrote:
>> Hi Nic,
>> 
>> I have implemented parts from Your solution, one more question though, what
>> is the purpose of
>> 
>> animationDuration =
>> UIKeyboard.AnimationDurationFromNotification(notification) ?
>> 
>> Because as far as I can see, everything animates without any explicit
>> declaration of animation.
>> 
>> Here is my code:
>> 
>> //WillShow
>> observer1 = NSNotificationCenter
>> .DefaultCenter
>> .AddObserver
>> (
>> UIKeyboard.WillShowNotification
>> ,delegate(NSNotification notification)
>> {
>> RectangleF frame;
>> if(notification != null)
>> {
>> RectangleF kbdRect = UIKeyboard.FrameEndFromNotification(notification);
>> //double animationDuration =
>> UIKeyboard.AnimationDurationFromNotification(notification);
>> 
>> if(notification.Name == UIKeyboard.WillShowNotification || notification.Name
>> == UIKeyboard.DidShowNotification)
>> {
>> if(this.NavigationController.InterfaceOrientation ==
>> UIInterfaceOrientation.Portrait)
>> {
>> frame = textView.Frame;
>> frame.Height -= kbdRect.Height;
>> textView.Frame = frame;
>> }
>> else
>> {
>> frame = textView.Frame;
>> frame.Height -= kbdRect.Width;
>> textView.Frame = frame;
>> }
>> 
>> 
>> }
>> else
>> frame = new RectangleF(0,0,0,0);
>> 
>> 
>> }
>> else
>> {
>> //keyboardHeight = VisibleKeyboardHeight;
>> }
>> 
>> 
>> 
>> 
>> }
>> );
>> 
>> 
>> On Feb 19, 2013, at 12:10 AM, Iki <[email protected]> wrote:
>> 
>> 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/
>> 
>> 
>> 
> 
> 
> 
> --
> 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