Это то, что я не понимаю. Посмотрите этот метод (скопировано из http://blog.blackwhale.at/2009/07/uibutton-in-uitableview-footer/)iphone - это будет утечка?
Посмотрите, что footerView выделяется в начале кода и никогда не отпускается. Насколько я понимаю, объект должен быть автореализован или, по крайней мере, выпущен после использования в обычном футляре, но поскольку этот метод запускается автоматически по таблицам при их создании, где именно будет выпущено это представление ...
или это будет протекать? Я видел образцы Apple кода с такими вещами, поэтому я предполагаю, что объект где-то выпущен ... но где?
// custom view for footer. will be adjusted to default or specified footer height
// Notice: this will work only for one section within the table view
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
if(footerView == nil) {
//allocate the view if it doesn't exist yet
footerView = [[UIView alloc] init];
//we would like to show a gloosy red button, so get the image first
UIImage *image = [[UIImage imageNamed:@"button_red.png"]
stretchableImageWithLeftCapWidth:8 topCapHeight:8];
//create the button
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button setBackgroundImage:image forState:UIControlStateNormal];
//the button should be as big as a table view cell
[button setFrame:CGRectMake(10, 3, 300, 44)];
//set title, font size and font color
[button setTitle:@"Remove" forState:UIControlStateNormal];
[button.titleLabel setFont:[UIFont boldSystemFontOfSize:20]];
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
//set action of the button
[button addTarget:self action:@selector(removeAction:)
forControlEvents:UIControlEventTouchUpInside];
//add the button to the view
[footerView addSubview:button];
}
//return the view for the footer
return footerView;
}
спасибо.
iPhone может просачиваться, но iPad является суперпоглощающим. – JasCav