/ / Dodaj program admob do góry lub dołu UITableView programowo? - ios, kakao-dotyk, uitableview

Dodaj programowo widok admob do górnej lub dolnej części UITableView? - ios, cocoa-touch, uitableview

wprowadź opis obrazu tutaj

Mam nadzieję dodać widok admob na górze lub na dole UITableView. W Konstruktorze interfejsów jest to łatwe - po prostu przeciągnij widok na górę lub na dół UITableView. Ale chciałbym dynamicznie dodawać widok do góry lub dołu tabeli za pomocą kodu.

Odpowiedzi:

3 dla odpowiedzi № 1

Możesz dodać widoki nagłówka lub stopki do a UITableView poprzez wdrożenie następujących UITableViewDelegate metody w twoim UITableViewController:

- (CGFloat)tableView:(UITableView *)tableView
heightForHeaderInSection:(NSInteger)section
{
CGFloat height = 100.0; // this should be the height of your admob view

return height;
}

- (UIView *)tableView:(UITableView *)tableView
viewForHeaderInSection:(NSInteger)section
{
UIView *headerView = myAdMobView; // init your view or reference your admob view

return headerView;
}

Aby uzyskać więcej informacji, zobacz dokumentacja protokołu UITableViewDelegate.


0 dla odpowiedzi nr 2

ustaw nagłówek tabeli Widok i stopka