AlertViewにテキストフィールドを表示する簡単な方法があります。これでメモリリークを示すインストゥルメント。説明してください。iOS ARC UIAlertViewリークメモリ
- (void)method {
NSString *value = [[NSUserDefaults standardUserDefaults] valueForKey:@"key"];
if (value == nil) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Title" message:@"message" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
alertView.tag = 101;
alertView.alertViewStyle = UIAlertViewStylePlainTextInput;
UITextField *txtGroup = [alertView textFieldAtIndex:0];
[txtGroup becomeFirstResponder];
[alertView show];
alertView = nil;
}
}
は、なぜあなたはalertView = nilを作っていますか?表示した後? –
私はどこかを読んで、オブジェクトをリリースするには、使用後にnilに設定する必要があります。 – PK86
ここからhttp://blog.harbinger-systems.com/2014/04/ios-memory-management-and-arc/ – PK86