2010-07-20 10 views
11

मैं उपयोग scrollview को प्रदर्शित करने और pagecontrolUIPageControl

scrollView=[[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 179)]; 
    pageControl=[[UIPageControl alloc] initWithFrame:CGRectMake(0, 179, 320, 20)]; 

    scrollView.delegate = self; 
    [scrollView setBackgroundColor:[UIColor blackColor]]; 
    [scrollView setCanCancelContentTouches:NO]; 
    scrollView.indicatorStyle = UIScrollViewIndicatorStyleWhite; 
    scrollView.clipsToBounds = YES; 
    scrollView.scrollEnabled = YES; 
    scrollView.pagingEnabled = YES; 

    int index=[[self._parameters objectForKey:@"index"] intValue]; 
    NSString *imageNamePrefix=[[activeAppIdList objectAtIndex:index] objectForKey:@"AppID"]; 
    int noOfScreenShot=[[[activeAppIdList objectAtIndex:index] objectForKey:@"NoOfScreenShot"] intValue]; 

    CGFloat cx = 0; 
    for (int j=1;j<=noOfScreenShot ; j++) { 
     UIImage *image =[[UIImage alloc] init]; 
     image= [self loadImage:[[NSString alloc]initWithFormat:@"%@_%d.jpg",imageNamePrefix,j]]; 

      if (image == nil) { 

      NSString *urlString = [[NSString alloc]initWithFormat:@"http://localhost/MoreApp/images/%@_%d.jpg",imageNamePrefix,j]; 

       NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:urlString]]; 
      UIImage *temp=[[UIImage alloc]initWithData:imageData] ; 

      [self saveImage:temp withName:[[NSString alloc]initWithFormat:@"%@_%d.jpg",imageNamePrefix,j]]; 

      image = temp; 
      [temp release]; 
      [urlString release]; 
     } 

     UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; 
     [image release]; 
     imageView.frame = CGRectMake(cx,0,scrollView.frame.size.width,scrollView.frame.size.height); 
       [scrollView addSubview:imageView]; 
     [imageView release]; 

     cx += scrollView.frame.size.width; 


    } 

    NSLog(@"No Of pages..%d",noOfScreenShot); 
    pageControl.numberOfPages = noOfScreenShot; 
    pageControl.currentPage = 0; 
     scrollView.contentSize = CGSizeMake(cx,scrollView.frame.size.height); 

    NSLog(@"Width:%f",scrollView.frame.size.width); 

    [ refToSelf.instructionView addSubview:scrollView]; 
    [ refToSelf.instructionView addSubview:pageControl]; 


    [scrollView release]; 
    [pageControl release]; 

scrollview ठीक है लेकिन pagecontroll से पता चला नहीं था के लिए निम्न ... मदद कर सकते हैं प्रदर्शित नहीं किया जाता ??

+0

ठीक है..मैं इसे बढ़ा दिया है .... – Rony

+0

यदि आपने अपना प्रश्न हल किया है, तो इसके लिए समाधान पोस्ट करें और उत्तर के रूप में चिह्नित करें। – Tsimmi

उत्तर

28

यदि पृष्ठ नियंत्रण और कंटेनर का पृष्ठभूमि रंग समान है (डिफ़ॉल्ट रूप से सफेद) पृष्ठ नियंत्रण दिखाई नहीं देगा।

+1

हाँ ... यह एक गलती थी ..... पृष्ठभूमि और पेज नियंत्रण दोनों में एक ही रंग है .... इसलिए यह दिखाई नहीं दे रहा था ... – Rony

2

मेरी गलती समान रूप से परेशान थी - 3.5 इंच दृश्य में स्टोरीबोर्ड के साथ विकास, और सिम्युलेटर पर 4 इंच डिवाइस पर बनाया गया ताकि यह ऑफस्क्रीन हो। बेवकूफ!

10

किसी को भी यह ढूंढने वाले किसी भी व्यक्ति के लिए, UIPageControl पर विशेषता को सेट नहीं करना है, जो इसे प्रदर्शित नहीं करेगा।

+0

यह मेरी गलती थी .. –

संबंधित मुद्दे