开发者

xCode simulator won't show keyboard

开发者 https://www.devze.com 2023-04-07 04:40 出处:网络
If I start up a blank app (single view application) and simply put a UITextField into the NIB, everything is fine: a keyboard will show up once I click the UI开发者_如何学CTextField in the simulator.

If I start up a blank app (single view application) and simply put a UITextField into the NIB, everything is fine: a keyboard will show up once I click the UI开发者_如何学CTextField in the simulator.

If I start up the app I'm working on at the moment, the keyboard will not show up (as if I had turned on simulate Hardware keyboard) and I am not able to enter any text at all. If I run the same app on my phone, however, the keyboard will show up and I can enter text as usual.

I'm sure it has to do with my code as the blank app will show a keyboard on the simulator. My set up is as follows: I have a RootViewController and then add another ViewController. In this ViewController I add yet another ViewController (where I want the UITextField to be) like so:

if (self.addNotebook == nil) {

    NSLog(@"create...");
    AddNotebookViewController *avc = [[AddNotebookViewController alloc]
                                   initWithNibName:nil bundle:nil];
    self.addNotebook = avc;
    [avc release];

}

[self.view addSubview:addNotebook.view];

There is hardly anything in this new ViewController:

#import <Foundation/Foundation.h>

@interface AddNotebookViewController : UIViewController <UITextFieldDelegate>
{
}

...

The xib is set up as follows:

One simple UITextField

File's Owner Class = AddNotebookViewController

File's Owner Outlet view = view

Text Field delegate = File's owner

So I don't understand why the keyboard doesn't pop up in the simulator while it does on my phone... any suggestions would be very much welcome!


Ok, I think I found the problem. It has to do with iOS 5, so I guess we can't really discuss this here. If I run the app on iOS 5, I won't see the keyboard on the phone or on the simulator.

If I rung the app on iOS 4 or on Simulator iOS 4 everything is fine and everyone happy.

I still don't know why this is so... I guess I need to head over to the apple discussion forum for these kind if questions?

Thanks

0

精彩评论

暂无评论...
验证码 换一张
取 消