質問

I have UIViewController with UITextField in it.

#import <UIKit/UIKit.h>

@interface TextMemoViewController : UIViewController<UITextFieldDelegate> 

@property (unsafe_unretained, nonatomic) IBOutlet UITextField *textMemo;

@end

In implementation code is next:

#import "TextMemoViewController.h"

@implementation TextMemoViewController
@synthesize textMemo;

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.textMemo.delegate = self;


}
//.....
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
    return YES;
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [textField resignFirstResponder];
    return  YES;
}

The problem is, when i click on textField - keyboard appears, but nothing can be pressed on it. All Simulator hangs up. Text input is not possible with this behavior.

I have couple of some UIViewControllers with textFields and all is ok. But here, i can not find the reason why it happens. I have cleaned DerivedData in Xcode, restarted all simulators and reset setting for them. Same situation on iphone. Does anyone has ideas?

役に立ちましたか?

解決 3

A better late, than never :)

Thanks all, but as i found a long time ago, the problem was in NOT resigned responder in some previous views. In this case, view was covered by other one, but responder was not changed.

Maybe someone will find this useful.

他のヒント

Please check your UIAlertView delegate.

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
  // DO NOT Create Other UIAlertView.
}

I think this is bug, on iOS 5.1.

I think you need to change:

@property (unsafe_unretained, nonatomic) IBOutlet UITextField *textMemo;

to:

@property (strong, nonatomic) IBOutlet UITextField *textMemo;

The difference is strong instead of unsafe_unretained. I believe your view is being unretained and that's why you aren't able to interact with it.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top