Hi guys,
I am new to cocoa framework.now i am creating registration form which includes uitextview. and i created a custom keyboard. when i start typing custom keyboard will pop up correctly work as same as uikeyboard.my problem is when orientation is changed that is portrait to landscape custom keyboard appear with portrait mode size. i have two different xib file one for portrait mode and another for landscape mode. initially keyboard appear in portrait mode . how do i load the landscape xib file in landscape mode.
I am new to cocoa framework.now i am creating registration form which includes uitextview. and i created a custom keyboard. when i start typing custom keyboard will pop up correctly work as same as uikeyboard.my problem is when orientation is changed that is portrait to landscape custom keyboard appear with portrait mode size. i have two different xib file one for portrait mode and another for landscape mode. initially keyboard appear in portrait mode . how do i load the landscape xib file in landscape mode.
Code:
//.h file
IBOutlet UITextView *textView;
IBOutlet UIView *accessoryView,*LAccessoryView;
//.m file
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
textView.inputView=nil;
if ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) ||(interfaceOrientation == UIInterfaceOrientationLandscapeRight))
{
[[NSBundle mainBundle] loadNibNamed:@"LAccessoryView" owner:self options:nil];
textView.inputView = LAccessoryView;
self.LAccessoryView = nil;
}
else if ((interfaceOrientation == UIInterfaceOrientationPortrait) ||(interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown))
{
[[NSBundle mainBundle] loadNibNamed:@"accessoryView" owner:self options:nil];
textView.inputView = accessoryView;
self.accessoryView = nil;
}
return YES;
}
Last edited by a moderator: