I have a UITextField and in the delegate class I have a UITableView. Here is the code:
- (BOOL) textField: (UITextField *)theTextField shouldChangeCharactersInRange: (NSRange)range replacementString: (NSString *)string {
value = [[theTextField.text stringByReplacingCharactersInRange:range withString:string] retain];
[valueTable reloadData];
return YES;
}
"value" is an NSString declared at the top of my class as "NSString *value;" and "valueTable" is just a UITableView. When I test for memory leaks, I am getting a "100%" memory leak on the line "value = [[theTextField.text stringByReplacing..." and I tried removing the "retain" on that line. However then later on when I called upon "value," it was nil, which is not good.
So how can I fix the memory leak? And what is the memory leak? Thanks!