Iphone 当键盘显示时,内存迅速增加到一个高值
uitableview中有两个文本字段。我创建它们如下:Iphone 当键盘显示时,内存迅速增加到一个高值,iphone,memory-leaks,keyboard,uitextfield,Iphone,Memory Leaks,Keyboard,Uitextfield,uitableview中有两个文本字段。我创建它们如下: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *MyIdentifier = @"MyIdentifier"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifie
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *MyIdentifier = @"MyIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier] autorelease];
if ([indexPath row] == 0) {
// text = [[UITextField alloc] initWithFrame:CGRectMake(5, 5, 300, 30)];
text.delegate=self;
text.userInteractionEnabled=NO;
text.contentVerticalAlignment=UIControlContentVerticalAlignmentCenter;
if(qNum-1==53)
text.placeholder=@"Category";
[cell.contentView addSubview:text];
[text release];
}
if ([indexPath row] == 1) {
// text2 = [[UITextField alloc] initWithFrame:CGRectMake(5, 5, 300, 30)];
text2.delegate=self;
text2.userInteractionEnabled=NO;
if(qNum-1==53)
text2.placeholder=@"Subcategory";
text2.contentVerticalAlignment=UIControlContentVerticalAlignmentCenter;
[cell.contentView addSubview:text2];
[text2 release];
}
}
cell.accessoryType = UITableViewCellAccessoryNone;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
我的问题是当键盘出现时,当我开始在textfield中键入字符时,内存迅速增加。这是正常的还是我失踪的原因?提前谢谢。请帮我解决这个问题:(它增加了多少?隐藏键盘时它会减少吗(在文本字段上呼叫
辞职第一响应者
)?应用程序正在崩溃,而你认为它是内存吗?或者你正在监控分配,如果是的话,它会有多高?什么类型的对象似乎占据了最多的空间?@booleanBoy嗨,你解决了这个问题吗?请告诉我,我这里也有同样的问题