2010-12-02 13 views
0

ここでは、ニュースアプリのために、各セクションの水平ページングのためにスクロールビュー内のビューをロードしていますが、問題はありません。PageControlのデモは多くの助けになりました各セクションの内容を表示できるように、別のスクロールビュー内でビューをロードする必要があります.NIBファイル上にカスタムデザインのビューが必要なので、各セクションが異なって見えるため、plistを使用してロードします各カスタムビューは汎用スクロールビューで表示されます。ここでplscからビューを読み込んでいます

は私が今まで得たものである:事前

答えて

0

- (void)loadScrollViewWithPage:(int)page{ 
    if (page < 0) 
     return; 
    if (page >= kNumberOfPages) 
     return; 

    // replace the placeholder if necessary 
    Seccion *controller = [viewControllers objectAtIndex:page]; 
    if ((NSNull *)controller == [NSNull null]) 
    { 
     controller = [[Seccion alloc] initWithPageNumber:page]; 
     [viewControllers replaceObjectAtIndex:page withObject:controller]; 
     [controller release]; 
    } 

    // add the controller's view to the scroll view 
    if (controller.view.superview == nil) 
    { 
     NSDictionary *numberItem = [self.contentList objectAtIndex:page]; 
     //UIImage *image1 = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image1.jpg" ofType:nil]]; 

     controller.sectionTitle.text = [numberItem valueForKey:Nombre]; 
     controller.sectionView.text = [numberItem objectForKey:Vista]; 
     controller.sectionId.text = [numberItem valueForKey:Id]; 



     //Here is supposed to have the code to load the view inside the scroll view I tried using: [controller.sectionScrollView addSubview:controller.sectionView.text]; 

     CGRect frame = scrollView.frame; 
     frame.origin.x = frame.size.width * page; 
     frame.origin.y = 0; 
     controller.view.frame = frame; 
     [scrollView addSubview:controller.view];   
    } 
} 

おかげで多くのことを、すべてのあなたの意見は、それが、これはうまくいくかもしれない、ペン先を所有している場合:

UIView *view = [[[NSBundle mainBundle] loadNibNamed:@"MyView" owner:self options:nil] objectAtIndex:0]; 

ますので、 plistの各ペン先の名前を保存することができます。

+0

ありがとう、本当に便利でした。実際には、同じNIBファイル内のビューを使用していましたが、名前はそれぞれ異なりますが、コードを変更して自分の使い方を変えることができました。 – fruvalcaba

関連する問題