When UIKeyboard
is called, memory is allocated and not freed when UIKeyboard
is hidden. If it is the framework who is caching it, is there any way to clear it up?
These code is what I use to create the UITextField
and how I hide the 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;
}
When you open the Keyboard for first time, it is cached by iOS native framework. Its handle by UIKit framework.
Its not the memory leak. Next time onwards when there will be a requirement to display keyboard, application will use cached keyboard.
If the memory requirement goes high, native framework will release the cached views, if required. Still the application needs memory, framework will generate memory warnings for same.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With