2012-01-26 747 views
1

我有UITextField在其中的UIViewController。UITextField - 無法輸入文字。鍵盤不響應

#import <UIKit/UIKit.h> 

@interface TextMemoViewController : UIViewController<UITextFieldDelegate> 

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

@end 

在實現代碼旁邊:

#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; 
} 

的問題是,當我在文本框點擊 - 出現鍵盤,但沒有什麼可以在它被按下。所有模擬器掛斷。文字輸入不可能出現這種行爲。

我有幾個UIViewControllers與textFields和一切都好。但在這裏,我找不到它發生的原因。 我已經清理了Xcode中的DerivedData,重新啓動了所有模擬器併爲它們重置了設置。 iPhone上的情況也是如此。 有沒有人有想法?

+0

您是否檢查過當您嘗試輸入文本時文本字段是否不爲零?超級視圖夠大嗎?我認爲超級視圖之外的文本字段會顯示,但不會對輸入做出反應。 – dasdom

+0

不,textField不是零。 (BOOL)textFieldShouldBeginEditing:(UITextField *)textField { return YES;(BOOL)textFieldShouldBeginEditing:(UITextField *)textField { return YES; } textField有它的地址和值。父視圖很大。只有這一個textField出現在它上面。 – boder

回答

-1

一個更好的後期,比從不:)

感謝所有,但爲我找了很久很久以前,這個問題在以前的一些看法不甘響應。 在這種情況下,視圖被其他人覆蓋,但響應者沒有改變。

也許有人會覺得這有用。

+1

你怎麼解決問題? – 2013-08-05 10:00:21

+0

請澄清你是如何解決這個問題的 – shreddish

0

我認爲你需要改變:

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

到:

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

不同的是strong而不是unsafe_unretained。我相信你的觀點是沒有保留的,這就是爲什麼你無法與之互動。

1

請檢查您的UIAlertView代表。

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

我認爲這是在iOS 5.1上的錯誤。