2011-02-21 5 views
0

나는 이것에 아무런 도움이되지 않을 것이라고 끊임없이 연구했습니다.홀수 스크롤 문제 (UIScrollView)

사용자 정의 셀/하위 뷰에서로드하는 UIView의 왼쪽 절반에 UIScrollView가 있습니다. UIView는 UINavigation 스택의 일부이며 TabBar의 탭에도로드됩니다.

내가 앱을 시작하고 즉시 스크롤을 시작하면 매우 부드럽습니다. 그러나 내가 앱을 시작하고 5-10 초를 기다린다면, UIScrollView는 매우 지저분하고 고르지 만 (그런 식으로 남아있다). 나는 이것이 메모리 누수가 될 것이라고 생각하지만 아무것도 찾을 수없는 것 같습니다.

UIScrollView에 사용자 지정 셀/하위 뷰를로드하는보기의 코드가 포함되어 있습니다. 셀 하위보기에는 사용자 지정 코드가 없습니다. 아, 그리고 약 8-10 개의 항목 만 있습니다. 각 항목에는 작은 (150x150) 이미지와 3 개의 텍스트 필드가 있습니다. 모두 불투명합니다.

#import "ProductListViewController.h" 
    #import "ProductListLeftItemViewController.h" 


    @implementation ProductListViewController 

    @synthesize listScroll; 



    - (void)viewDidLoad { 

     NSBundle *bundle = [NSBundle mainBundle]; 
     NSString *path = [bundle pathForResource:@"Products" ofType:@"plist"]; 
     NSArray *products = [[NSArray alloc] initWithContentsOfFile:path]; 
     // 
     int numProducts; 
     numProducts = [products count]; 
     [listScroll setContentSize:CGSizeMake(500, (numProducts * 111))]; 
     for (int i = 0; i < numProducts; i++) { 
      ProductListLeftItemViewController *cellItem = [[ProductListLeftItemViewController alloc] initWithNibName:@"ProductListLeftItem" bundle:nil]; 
      cellItem.view.frame = CGRectMake(0, (i*111), 500, 111); 

      [self.listScroll addSubview:cellItem.view]; 
      cellItem = nil; 
      [cellItem release]; 
     } 
     [products release]; 

     [super viewDidLoad]; 

    } 

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
     return (interfaceOrientation == UIInterfaceOrientationLandscapeRight); 
    } 

    - (void)didReceiveMemoryWarning { 
     // Releases the view if it doesn't have a superview. 
     NSLog(@"Memory warning, ProductListViewController"); 

     [super didReceiveMemoryWarning]; 

     // Release any cached data, images, etc that aren't in use. 
    } 

    - (void)viewDidUnload { 
     // Release any retained subviews of the main view. 
     // e.g. self.myOutlet = nil; 
    } 


    - (void)dealloc { 
     [listScroll release]; 
     [super dealloc]; 
    } 

    @end 

그리고 요청으로

의 ProductListLeftItemViewController 코드 : 앞으로이 문제가있는 사람들을위한

+0

URL에서 이미지를로드하고 있습니까? – iHS

+0

몇 개의 제품이 있습니까? ProductListLeftItemViewController를 보여줄 수 있습니까? cellItem을 nil로 설정 한 후 cellItem에 대한 호출을 BTW가 호출하면 난센스가 발생합니다. 이 두 줄은 서로 바꿔야합니다. – robertvojta

+0

Harinder : URL에서 이미지를로드하지 않고 사실, 전체 서브 뷰를 지워서 흰색 배경이 아닌 불투명 한 흰색 배경으로 만들었습니다. Chiefly Izzy : 단 8 개의 제품이지만, 단 한 개의 제품으로 최소한의 정보만으로도 시도했습니다. 동일한 결과입니다. 그리고 고마워, 나는 그 선들을 바꿨다. – KidIcarus271

답변

0

는, 일단 내가 실제 장치에서 테스트 일을 시작했다가, 모든 것이 완벽하게 매끄러운했다. 어쩌면 그것은 시뮬레이터와 기발한 것일까? 이 문제를 좀 더 자세히 조사 할 예정이지만 해결 된 것으로 생각합니다.