目前代码:无法取得UITextField [textField frame];
- (void)textFieldDidBeginEditing:(UITextField *)textField {
NSLog(@"begin edit: %@", textField);
}
相关输出:
2011-10-30 09:12:08.436 My Project[83470:207] begin edit: <UITextField: 0x6c349d0; frame = (112 2; 182 39); text = 'My Name'; clipsToBounds = YES; opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x6c34af0>>
所以我知道该文本框框架是存在的,但是当我试图抓住它:
代码:
- (void)textFieldDidBeginEditing:(UITextField *)textField {
NSLog(@"begin edit: %@", [textField frame]);
// also tried textField.frame -- same thing
}
错误:
Thread 1: EXC_BAD_ACCES (code=1, address=0x42e00000)
输出:
(lldb)
我一直纺在此我的车轮,我不知道接下来要去哪里。感谢您阅读我的问题。
**编辑 - 厦门国际银行的细胞实例(其中的文本框住)**
注:文本字段来自于厦门国际银行文件,这只是一个表格单元格。
static NSString *CellIdentifier = @"ValidatedTextViewTableCell";
ValidatedTextViewTableCell *cell = (ValidatedTextViewTableCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"ValidatedTextViewTableCell" owner:self options:nil];
cell = validatedTextViewTableCell;
self.validatedTextViewTableCell = nil;
}
我觉得因为有在代码中没有错误,你已经张贴你应该张贴你的代码的其余部分。另外,EXC_BAD_ACCESS通常是由于内存管理问题,所以我们需要如何实例化文本字段变量。 –
@XcodeDev我添加了一些关于文本字段来自哪里的更多信息。让我知道你是否需要看别的东西。 – Jacksonkr