Я уже завершил свое приложение кодирования в xcode 4, но я пытаюсь этот код на xcode 5, многие проблемы возникли в UITableview. строки таблицы и содержимое таблицы не отображаются. Обычно таблица отображается правильно, но я устанавливаю горизонтальные и разделительные линии для subview в представлении таблицы, что временные рамки устанавливают только строки и содержимое, которые не видны.Таблица Вид не отображается
В картине я установить цвет фона для Tableview в голубой цвет область так здесь содержание появляются только в белом цвете
{
UIView *subView=[[UIView alloc]initWithFrame:CGRectMake(5, 0, 510, ([subViewsDataArr count] * 50) + 10)];
subView.backgroundColor=[UIColor clearColor];
subView.layer.borderWidth = 1;
subView.layer.borderColor = [[UIColor blackColor] CGColor];
subView.layer.cornerRadius=5;
[myCell addSubview:subView];
int y = 5;
for (int j=0; j<[subViewsDataArr count]; j++, y = y+50) {
UIView *cellView =[[UIView alloc] init];
cellView.frame =CGRectMake(5, y, 500, 50);
cellView.backgroundColor =[UIColor clearColor];
[subView addSubview:cellView];
if (j == 0)
{
int x =-1;
UIImageView *horizontalLineImgStart =[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 500, 1)];
horizontalLineImgStart.image =[UIImage imageNamed:@"horizontalLine.png"];
[cellView addSubview:horizontalLineImgStart];
UIImageView *seperatorLineImgStart =[[UIImageView alloc] initWithFrame:CGRectMake(x, 0, 1, 50)];
seperatorLineImgStart.image =[UIImage imageNamed:@"seperatorLine.png"];
[cellView addSubview:seperatorLineImgStart];
for (int i=0; i < 8; i++) {
UILabel *cellLbl = [[UILabel alloc] init];
[cellLbl setText:[NSString stringWithFormat:@"%@",[[subViewsDataArr objectAtIndex:j] objectAtIndex:i]]];
cellLbl.textAlignment =UITextAlignmentCenter;
if (i == 0 || i == 1 || i == 4 || i == 5 || i == 6 || i == 7) {
cellLbl.font =[UIFont fontWithName:@"Helvetica Bold" size:12];
cellLbl.numberOfLines =2;
}
else
{
cellLbl.adjustsFontSizeToFitWidth =YES;
cellLbl.font =[UIFont fontWithName:@"Helvetica Bold" size:10];
}
[cellLbl setBackgroundColor:[UIColor clearColor]];
cellLbl.textColor =[UIColor grayColor];
[cellView addSubview:cellLbl];
UIImageView *seperatorLineImg =[[UIImageView alloc] init];
if (i == 0 || i == 1 || i == 2 || i == 5)
{
cellLbl.frame = CGRectMake(x + 1, 5, 55, 40);
seperatorLineImg.frame =CGRectMake(x + 55, 0, 1, 50);
x = x + 55;
}
else if (i == 6 || i == 7)
{
cellLbl.frame = CGRectMake(x + 1, 5, 80, 40);
seperatorLineImg.frame =CGRectMake(x + 80, 0, 1, 50);
x = x + 80;
}
else
{
cellLbl.frame = CGRectMake(x + 1, 5, 60, 40);
seperatorLineImg.frame =CGRectMake(x + 60, 0, 1, 50);
x = x + 60;
}
seperatorLineImg.image =[UIImage imageNamed:@"seperatorLine.png"];
[cellView addSubview:seperatorLineImg];
}
UIImageView *horizontalLineImgEnd =[[UIImageView alloc] initWithFrame:CGRectMake(0, 50, 500, 1)];
horizontalLineImgEnd.image =[UIImage imageNamed:@"horizontalLine.png"];
[cellView addSubview:horizontalLineImgEnd];
}
else
{
int x =-1;
UIImageView *horizontalLineImgStart =[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 500, 1)];
horizontalLineImgStart.image =[UIImage imageNamed:@"horizontalLine.png"];
[cellView addSubview:horizontalLineImgStart];
UIImageView *seperatorLineImgStart =[[UIImageView alloc] initWithFrame:CGRectMake(x, 0, 1, 50)];
seperatorLineImgStart.image =[UIImage imageNamed:@"seperatorLine.png"];
[cellView addSubview:seperatorLineImgStart];
for (int i=0; i < 8; i++ , txtFldTagVal= txtFldTagVal + 1) {
UITextField *cellTxtFld = [[UITextField alloc] init];
cellTxtFld.text =[NSString stringWithFormat:@"%@",[[subViewsDataArr objectAtIndex:j] objectAtIndex:i]];
cellTxtFld.textAlignment =UITextAlignmentCenter;
cellTxtFld.font =[UIFont fontWithName:@"Helvetica Bold" size:12];
[cellTxtFld setBackgroundColor:[UIColor clearColor]];
cellTxtFld.textColor =[UIColor brownColor];
cellTxtFld.tag =5000 + txtFldTagVal;
cellTxtFld.delegate =self;
cellTxtFld.adjustsFontSizeToFitWidth = YES;
[cellView addSubview:cellTxtFld];
UIImageView *seperatorLineImg =[[UIImageView alloc] init];
if (i == 0 || i == 1 || i == 2 || i == 5)
{
cellTxtFld.frame = CGRectMake(x + 1, 5, 55, 40);
seperatorLineImg.frame =CGRectMake(x + 55, 0, 1, 50);
x = x + 55;
}
else if (i == 6 || i == 7)
{
cellTxtFld.frame = CGRectMake(x + 1, 5, 80, 40);
seperatorLineImg.frame =CGRectMake(x + 80, 0, 1, 50);
x = x + 80;
}
else
{
cellTxtFld.frame = CGRectMake(x + 1, 5, 60, 40);
seperatorLineImg.frame =CGRectMake(x + 60, 0, 1, 50);
x = x + 60;
}
seperatorLineImg.image =[UIImage imageNamed:@"seperatorLine.png"];
[cellView addSubview:seperatorLineImg];
}
UIImageView *horizontalLineImgEnd =[[UIImageView alloc] initWithFrame:CGRectMake(0, 50, 500, 1)];
horizontalLineImgEnd.image =[UIImage imageNamed:@"horizontalLine.png"];
[cellView addSubview:horizontalLineImgEnd];
}
}
}
Объясните свой запрос четко с некоторой ссылкой, и только вы должны получить любую помощь здесь. – Ganapathy
Я создаю табличный вид с горизонтальными и разделительными линиями изображений, что рамка временного стола не добавила ничего видимого. –
если я настроен subview в представлении таблицы, то время только просмотр таблицы не отображается. –