#iphone #objective-c #xcode
#iPhone #objective-c #xcode
Вопрос:
Как я могу добавить описание типа «Калифорния» на это изображение.
Комментарии:
1. Ссылка на изображение не работает, пожалуйста, обновите изображение.
Ответ №1:
- (NSInteger)numberOfSections
{
return 1;
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
if (section == 0)
return @"California";
return nil;
}
Ответ №2:
Это заголовок вашей таблицы. Заголовок табличного представления для разделов. Вы можете иметь заголовки разделов, реализуя метод datasource
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
Ответ №3:
В вашем UITableViewDataSource (делегате UITableView),
этот метод управляет заголовками разделов:
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
Ответ №4:
Это заголовок раздела.Метод UITableViewDelegate является:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
Ответ №5:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView * view = [uiview alloc]initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 90)];
then Create UIView in UILable ,UItextView etc...
}
then
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 50;
}