2011-11-02 46 views
0

在一個TabBar應用程序中,我有一個小視圖,可以在其中繪製視圖。完美的作品。UITextField不起作用

與該代碼:

UITextField * textFieldRounded = [[UITextField alloc] initWithFrame:CGRectMake(10, 45.0, 260.0, 50)]; 
textFieldRounded.borderStyle = UITextBorderStyleRoundedRect; 
textFieldRounded.textColor = [UIColor blackColor]; //text color 
textFieldRounded.font = [UIFont systemFontOfSize:17.0]; //font size 
textFieldRounded.placeholder = @"<enter text>"; //place holder 
textFieldRounded.backgroundColor = [UIColor whiteColor]; //background color 
textFieldRounded.autocorrectionType = UITextAutocorrectionTypeNo; // no auto correction support 

textFieldRounded.keyboardType = UIKeyboardTypeDefault; // type of the keyboard 
textFieldRounded.returnKeyType = UIReturnKeyDone; // type of the return key 

textFieldRounded.clearButtonMode = UITextFieldViewModeWhileEditing; // has a clear 'x' button to the right 

textFieldRounded.userInteractionEnabled = YES; 

[skizzenFeldOutlet addSubview:textFieldRounded]; 

textFieldRounded.delegate = self; 

我創建一個文本框。它工作正常,但我不能把文本放在文本框中。文本框是可見的,但我可以在文本框下的視圖中繪製!

任何提示?

問候 安德烈亞斯

回答

0

因爲這個原因。

[skizzenFeldOutlet addSubview:textFieldRounded];

您的textField已被平添加到您的視圖中。

相關問題