2014-04-28 4 views
0

테이블보기가 있습니다. 나는 배열을 표시하고있다. 내가 마지막 테이블 셀의 맨 아래로 이동하지 않는 tableview 스크롤 할 때. 그 일을 어떻게해야합니까?하단 스크롤이 테이블보기에서 작동하지 않습니다.

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 
return 1;} 

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

return tableResourceArray.count;} 

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

     NSString *cellIdentifier=[NSString stringWithFormat:@"CustomCell:%d",indexPath.row]; 

customcell *cell = (customcell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier]; 
if (cell == nil) { 
    cell = [[customcell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; 

} 
    if(tableView==table) { 
      table.backgroundColor = [UIColor clearColor]; 
      table.separatorColor=[UIColor clearColor]; 


    NSDictionary *slug = [category objectAtIndex:indexPath.row]; 
      NSLog(@"gggg:%@",slug); 
      cell.ctitle.text = [NSString stringWithFormat:@"%@", [slug objectForKey:@"title"]]; 
      cell.ctitle.font=[UIFont fontWithName:@"Arial" size:12]; 

      cell.cdate.text = [NSString stringWithFormat:@"Date:%@", [slug objectForKey:@"date"]]; 
      cell.cdate.textColor=[UIColor colorWithRed:0.820 green:0.776 blue:0.526 alpha:1.000]; 
      cell.ccontent.text = [NSString stringWithFormat:@"%@", [slug objectForKey:@"content"]]; 

}

+0

tablview 프레임이란 무엇입니까? tableview 코드의 부모도 .. – ajay

+0

table.frame = CGRectMake (0, 130, 320, 480); 이것은 내 테이블 뷰 프레임입니다 – gowtham

+0

UINavigationCongroller를 사용하고 있습니까? – ajay

답변

0

해결 방법 1 : 비 정적 변수

당신은 선언 한 식별자. 스크롤 문제가 발생할 수 있습니다.

NSString *cellIdentifier=[NSString stringWithFormat:@"CustomCell:%d",indexPath.row]; 

대신 아래 사용

NSString *cellIdentifier= @"CustomCellIdentifier"; 

정적 변수 번만 구성하는데 사용하고 메모리 생성 "CellForRowAtIndexPath"메소드가 호출 될 때마다 항상 피한다. 비 정적 변수가 사용되면 많은 메모리가 생성되어 스크롤 문제가 발생할 수 있습니다.

해결책 2 : // 확실하지 않습니다. 그러나 도움이 될 수도 있습니다

사용하기 전에 사전 할당.

NSDictionary *slug = [[NSDictionary alloc] init]; 
    slug = [category objectAtIndex:indexPath.row]; 
0

테이블 뷰 프레임을 변경하여 문제를 해결했습니다.

0

화면 크기가 320x480이라고 가정하면 테이블보기 프레임 (원점 y 130 + 높이 480)으로 인해 테이블보기 프레임의 하단 부분이 130만큼 화면 밖으로 나옵니다. 또는 tableview를 덮는 화면의 하단에 더 많은 서브 뷰가있는 경우에는 더욱 그렇습니다. 테이블 뷰의 하단이 화면 하단에서 끝나도록 테이블 뷰 프레임을 변경하십시오.

관련 문제