没有响应的UITextField,第二次查看

时间:2013-08-16 18:01:05

标签: ios cocoa-touch uitextfield

我有一个UITextView,我在视图viewDidLoad事件中以编程方式创建。

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.


    inputText = [[UITextView alloc] initWithFrame:CGRectMake(15, 90, 290, 150)];

    [inputText.layer setBackgroundColor: [[UIColor whiteColor] CGColor]];
    [inputText.layer setBorderColor: [[UIColor grayColor] CGColor]];
    [inputText.layer setBorderWidth: 3.0f];
    [inputText.layer setCornerRadius:8.0f];
    [inputText.layer setMasksToBounds:YES];
    [inputText setFont:[UIFont systemFontOfSize:15]];

    [self.view addSubview:inputText];

}

这很好,第一次显示视图时,但第二次显示时,UITextView没有响应触摸,键盘没有弹出。

这是我直接观看的方式。

someotherView.m

-(IBAction)insertToTable:(id)sender {

       [self performSegueWithIdentifier:@"insertSegue" sender:self];
}

编辑1

完整代码:

.H     @interface ViewControllerInsert:UIViewController     {         UITextView * inputText;         UISegmentedControl * experienceValue;     }

- (IBAction)InsertAction:(id)sender;


@property (strong, nonatomic) IBOutlet UISegmentedControl *experienceValue;
@property (strong, nonatomic) IBOutlet UITextView *inputText;

@end

的.m

除了上面链接的代码,这就是

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    NSLog(@"touchesBegan:withEvent:");
    [self.view endEditing:YES];
    [super touchesBegan:touches withEvent:event];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

编辑2

发现问题,这是由我用过的动画吗?非常奇怪,我正在使用垂直翻转,但是当我换到默认时,它工作得很好吗?

0 个答案:

没有答案