У меня возникла эта проблема, когда я попытался преобразовать свое приложение из iOS6 в iOS7/iOS8.UITableView не отображает ячейки в IOS 7
UITableView
не отображает клетки (работа в iOS6).
У меня есть подобный вид, что прекрасно работает в iOS7 (он не имеет UISearchView
)
Я пытался несколько обходных путей, как очистить фона, удалить UISearchBar и т.д ...
код подобен в обоих примерах (клетки генерируются - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
методом)
Я использовал Reveal программное обеспечение для анализа этой иерархии.
Код, скомпилированный в XCODE 4 для поддержки iOS6, отлично работает. (Проверено на iPhone 5s с iOS7)
РЕДАКТИРОВАТЬ:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"CellAloj";
AlojamentoTableCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
if(cell==nil){
posicao=0;
}
posicao=70+(100*indexPath.row);
[bdAl.arrayFotos removeAllObjects]; NSMutableString *simbpreco=[[NSMutableString alloc]init];
NSNumber *id1=[bdAl.idAlojamento objectAtIndex:indexPath.row];
[self drawviewRank:[id1 integerValue]];
//posicao=posicao+100;
cell.backgroundView=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"aloj_cell3.png"]];
//Não aparecer mais celulas depois da última com conteúdo
UIView *footer = [[UIView alloc] initWithFrame:CGRectZero];
self.tableView1.tableFooterView = footer;
///////////////
[bdAl SelectFotos:[[bdAl.idAlojamento objectAtIndex:indexPath.row]integerValue]];
cell.nomeAloj.text=[bdAl.arrayNomeAloj objectAtIndex:indexPath.row];
cell.imgAloj.image=[[UIImage alloc]init];
UIImage *imagem=[bdAl.arrayFotos objectAtIndex:0];
cell.tipo.text=[bdAl.arrayTipoAloj objectAtIndex:indexPath.row];
cell.labelLocalidade.text=[bdAl.arrayLocalidade objectAtIndex:indexPath.row];
cell.imgAloj.image=imagem;
CALayer * l = [cell.imgAloj layer];
[l setMasksToBounds:YES];
[l setCornerRadius:10.0];
cell.detailAloj.text=[bdAl.arrayDescAloj objectAtIndex:indexPath.row];
int i=[[bdAl.arraypreco objectAtIndex:indexPath.row]integerValue];
for (int j=0; j<i; j++){
[simbpreco appendString:@"€"];
}
[tableView1 setSeparatorStyle:UITableViewCellSeparatorStyleSingleLine];
[tableView1 setSeparatorColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"nav_menu.png"]]];
cell.preco.text=simbpreco;
return cell;
EDIT2:
Раскадровка:
EDIT3: Этот метод возвращает 17 строк:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [bdAl.arrayNomeAloj count];
}
И метод numberOfSectionsInTableView:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
EDIT4:
#import <UIKit/UIKit.h>
#import "AlojamentoTableViewController.h"
@interface AlojamentoTableCell : UITableViewCell{
}
@property (strong, nonatomic) IBOutlet UILabel *tipo;
@property (strong, nonatomic)IBOutlet UILabel *nomeAloj;
@property (strong, nonatomic)IBOutlet UILabel *detailAloj;
@property (strong, nonatomic)IBOutlet UIImageView *imgAloj;
@property (strong, nonatomic) IBOutlet UILabel *labelLocalidade;
@property (strong, nonatomic)IBOutlet UILabel *preco;
@end
Вы пытались отключить автоспуск? –
@RezaShirazian да, такой же выпуск. –
Можете ли вы вставить свой tableView: cellForRowAtIndexPath: code? –