табличное представление с отображением изображения - PullRequest
0 голосов
/ 18 мая 2011

у меня есть изображение. Ниже изображение - это табличное представление .. которое загружает данные с сервера. По умолчанию пять полей в табличном представлении видны ... работает нормально ... если я прокручиваю табличное представление для просмотра остальные поля ... скроллер восстанавливается ... что я хочу, чтобы табличное представление было исправлено, а не отбрасывалось при прокрутке ... было бы здорово, если вы, ребята, можете мне помочь ... ниже приведен код

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 
{

   return 1;

}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
 {

return [items count];

}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section

{

 return 28.0;

}

- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section 

{

UIView *headerView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 

tableViewteam.bounds.size.width, 28)] autorelease];

    headerView.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle]pathForResource:@"team"ofType:@"png"]]];

    return headerView;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{

    static NSString *CellIdentifier = @"Cell";


    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell == nil) {

 cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault 

reuseIdentifier:CellIdentifier] autorelease];


}


    cell.selectionStyle=UITableViewCellSelectionStyleNone;

    cell.imageView.backgroundColor=[UIColor clearColor];

cell.textLabel.text=[[items objectAtIndex:indexPath.row]objectForKey:@"title"];

    cell.textLabel.textColor=[UIColor whiteColor];

    cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;

    return cell;
}

Ответы [ 2 ]

4 голосов
/ 18 мая 2011

Я не до конца понял вашу проблему. Если вы хотите прекратить подпрыгивать представление таблицы, вы можете добавить

yourTableView.bounces = NO;

в ViewDidLoad()

1 голос
/ 18 мая 2011

Если вам нужно исправить TableView, вы можете отключить прокрутку.

tableView.scrollEnabled = NO;
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...