3
調用UIKeyboard
時,當隱藏UIKeyboard
時,將分配內存並不釋放內存。如果是緩存的框架,有什麼方法可以清除它? 這些代碼是我用來創建UITextField
,我怎麼隱藏UIKeyboard
:在顯示ARC上的UIKeyboard時發生內存泄漏
#import <UIKit/UIKit.h>
@interface SignInTextField : UITextField
-(id)initWithIndexPath:(NSIndexPath*)indexPath;
@end
#import "SignInTextField.h"
@implementation SignInTextField
-(id)initWithIndexPath:(NSIndexPath*)indexPath{
self = [super init];
if (self) {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
// iPad
self.frame = CGRectMake(110, 10, 600, 30);
} else {
self.frame = CGRectMake(110, 11, 150, 30);
}
self.tag = [indexPath row];
self.returnKeyType = UIReturnKeyDone;
self.autocapitalizationType = UITextAutocapitalizationTypeNone;
}
return self;
}
//SettingTextField
SignInTextField *textField = [[SignInTextField alloc]initWithIndexPath:indexPath];
textField.delegate = self;
#pragma mark - Text Field CallBack
-(void)textFieldDidBeginEditing:(UITextField *)textField{
activeField = textField;
}
- (void)textFieldDidEndEditing:(UITextField *)textField {
if(textField.tag == 0) temp_email = [NSString stringWithFormat:@"%@",textField.text];
if(textField.tag == 1) temp_password = [NSString stringWithFormat:@"%@",textField.text];
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
[textField resignFirstResponder];
return YES;
}
請問,你能告訴我們你使用的代碼嗎? – Jean 2013-03-18 13:03:54
什麼讓你覺得你有內存泄漏?如果您知道,請告訴我們您的儀器的讀數。 – Peres 2013-03-18 13:27:46