Hi List, 

Still new to Cocoa...

In placed a new ViewController following the example in UICatalog. I got it 
working but was wondering how to make the view also editable in landscape 
view...

Below is the code to display the keyboard and hide the keyboard, which I 
supplemented with the if... else if statements.

- (void)keyboardWillShow:(NSNotification *)aNotification 
{
        UIInterfaceOrientation orientation = [[UIApplication sharedApplication] 
statusBarOrientation];
        if (orientation == UIInterfaceOrientationPortrait) {
                        // the keyboard is showing so resize the table's height
                CGRect keyboardRect = [[[aNotification userInfo] 
objectForKey:UIKeyboardBoundsUserInfoKey] CGRectValue];
                NSTimeInterval animationDuration = [[[aNotification userInfo] 
objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue];
                CGRect frame = self.view.frame;
                frame.size.height -= keyboardRect.size.height;
                [UIView beginAnimations:@"ResizeForKeyboard" context:nil];
                [UIView setAnimationDuration:animationDuration];
                self.view.frame = frame;
                [UIView commitAnimations];
        } else if (orientation == UIInterfaceOrientationLandscapeLeft) {
                NSLog(@"Left"); // Verijderen later
                CGRect keyboardRect = [[[aNotification userInfo] 
objectForKey:UIKeyboardBoundsUserInfoKey] CGRectValue];
                NSTimeInterval animationDuration = [[[aNotification userInfo] 
objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue];
                CGRect frame = self.view.frame;
                frame.size.height -= keyboardRect.size.height;
                [UIView beginAnimations:@"ResizeForKeyboard" context:nil];
                [UIView setAnimationDuration:animationDuration];
                self.view.frame = frame;
                [UIView commitAnimations];
        } else if (orientation == UIInterfaceOrientationLandscapeRight){
                NSLog(@"Right"); // verwijderen later.
                CGRect keyboardRect = [[[aNotification userInfo] 
objectForKey:UIKeyboardBoundsUserInfoKey] CGRectValue];
                NSTimeInterval animationDuration = [[[aNotification userInfo] 
objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue];
                CGRect frame = self.view.frame;
                frame.size.width -= keyboardRect.size.width;
                [UIView beginAnimations:@"ResizeForKeyboard" context:nil];
                [UIView setAnimationDuration:animationDuration];
                self.view.frame = frame;
                [UIView commitAnimations];
        }
        
}

I know that I have to change the line frame.size.hight -= 
keyboardRect.size.hight, but I cannot figure out into what....

If I change the line in the landscape left mode to: frame.size.width -= 
keyboardRect.size.width. The view works, but the statusbar is huge, and the 
right button is gone.... 

Into what do I have to change this line

Kind regards in advance

Arnold Nefkens

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to