- 论坛徽章:
- 0
|
- - (IBAction)butonPressed:(id)sender
- {
- NSInteger stateRow = [picker selectedRowInComponent:kStateComponent];
- NSInteger zipRow = [picker selectedRowInComponent:kZipComponent];
-
- NSString *state = [self.states objectAtIndex:stateRow];
- NSString *zip = [self.zips objectAtIndex:zipRow];
-
- NSString *title = [[NSString alloc] initWithFormat:@"You selected zip code %@.", zip];
- NSString *message = [[NSString alloc] initWithFormat:@"%@ is in %@", zip, state];
-
- UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title message:message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
- [alert show];
- [alert release];
- [title release];
- [message release];
- NSLog(@"-----> %@", title);//还是可以访问到,why??
- }
复制代码 为什么release后的对象还能够访问,既然这样又何必release 呢? |
|