Advertisement
Guest User

Scroll Images Magazine

a guest
Dec 10th, 2012
397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. #import "RevistaPortraitViewController.h"
  3. #import "AppDelegate.h"
  4.  
  5. @interface RevistaPortraitViewController ()
  6. @end
  7.  
  8. @implementation RevistaPortraitViewController
  9.  
  10. #define NUM_PAGES 128
  11.  
  12. - (void)dealloc
  13. {
  14.     [scroll release];
  15.     [super dealloc];
  16. }
  17.  
  18. - (void)didReceiveMemoryWarning
  19. {
  20.     // Releases the view if it doesn't have a superview.
  21.     [super didReceiveMemoryWarning];
  22.    
  23.     // Release any cached data, images, etc that aren't in use.
  24. }
  25.  
  26.  
  27. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  28. {
  29.     self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
  30.     if (self) {
  31.         // Custom initialization
  32.     }
  33.     return self;
  34. }
  35.  
  36.  
  37. //-(void)carregarListaDeImagens {
  38. //    [listaImagens removeAllObjects];
  39. //    [listaImagens addObject:@"w29_capa_p.jpg"];
  40. //    for (int iCnt = 2; iCnt < NUM_PAGES-1; iCnt++) {
  41. //        if(iCnt > 10)
  42. //        [listaImagens addObject:[NSString stringWithFormat:@"w29_%i_p.jpg",iCnt]];
  43. //        else
  44. //        [listaImagens addObject:[NSString stringWithFormat:@"w29_%0i_.jpgp",iCnt]];
  45. //    }
  46. //}
  47.  
  48. - (void)viewDidLoad
  49. {
  50.    
  51.    
  52.    
  53.     //myImageView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 10, 320, 350)];
  54.     // [self.view addSubview:myImageView];
  55.    
  56.    
  57.     [scroll setDelegate:self];
  58.     [scroll setContentSize:CGSizeMake(scroll.frame.size.width * NUM_PAGES, scroll.frame.size.height)];
  59.     [scroll scrollRectToVisible:CGRectMake(scroll.frame.size.width * (_paginaAtual), scroll.frame.origin.y, scroll.frame.size.width, scroll.frame.size.height) animated:NO];
  60.    
  61.    
  62.     //load the first and second page.
  63.    
  64.    
  65.     [super viewDidLoad];
  66.     // Do any additional setup after loading the view from its nib.
  67. }
  68.  
  69.  
  70. - (void)scrollViewDidScroll:(UIScrollView *)scrollView
  71. {
  72.     CGPoint scrollOffset=scrollView.contentOffset;
  73.    
  74.    
  75.     ///at any time, it will have only 3 pages loaded- previous, current and next
  76.     if(pageOnScrollView < ((int)scrollOffset.x/scroll.frame.size.width))
  77.     {
  78.         //unload
  79.         if(pageOnScrollView>1)[self unloadPreviousPage:pageOnScrollView-1];
  80.        
  81.         //load the next page
  82.         [self loadNextPage:((int)scrollOffset.x/scroll.frame.size.width)+1];
  83.     }
  84.     else if(pageOnScrollView > ((int)scrollOffset.x/scroll.frame.size.width))
  85.     {
  86.         //unload
  87.         if(pageOnScrollView<(NUM_PAGES-2))[self unloadPreviousPage:pageOnScrollView+2];
  88.        
  89.         //load back the previous page
  90.         [self loadNextPage:((int)scrollOffset.x/scroll.frame.size.width)-1];
  91.     }
  92.    
  93.     pageOnScrollView=scrollOffset.x/scroll.frame.size.width;
  94. }
  95.  
  96. -(void)unloadPreviousPage:(int)index
  97. {
  98.    
  99.    
  100.    
  101.     for(int i=index*1;i<(index+1)*1;i++)
  102.     {
  103.         [[scroll viewWithTag:i+1] removeFromSuperview];
  104.        
  105.     }
  106.    
  107.    
  108. }
  109.  
  110. -(void)loadNextPage:(int)index
  111. {
  112.    
  113.    
  114.     int countFlag=0;
  115.     for(int i=index*1;i<(index+1)*1;i++)
  116.     {
  117.         //create the UIImageViews and stick them on the scrollview
  118.         UIImageView *imageView=[[UIImageView alloc]initWithFrame:CGRectMake((scroll.frame.size.width*index)+countFlag*(scroll.frame.size.height - 10)+ 2, 0, scroll.frame.size.width, scroll.frame.size.height)];
  119.         imageView.tag=i+1;
  120.         // [imageView addTarget:self action:@selector(imageViewClicked:) forControlEvents:UIControlEventTouchUpInside];
  121.         //  [imageView.layer setBorderColor:[UIColor lightGrayColor].CGColor];
  122.         //[imageView.layer setBorderWidth:1.0f];
  123.         int indice = (index+1)%128;
  124.         UIImage *img = nil;
  125.         NSString *path = @"";
  126.         switch (indice) {
  127.             case 0:
  128.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  129.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  130.                 [imageView setImage:img];
  131.                 [img release];
  132.                 break;
  133.             case 1:
  134.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  135.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  136.                 [imageView setImage:img];
  137.                 [img release];
  138.                 break;
  139.             case 2:
  140.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  141.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  142.                 [imageView setImage:img];
  143.                 [img release];
  144.                 break;
  145.             case 3:
  146.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  147.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  148.                 [imageView setImage:img];
  149.                 [img release];
  150.                 break;
  151.             case 4:
  152.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  153.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  154.                 [imageView setImage:img];
  155.                 [img release];
  156.                 break;
  157.             case 5:
  158.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  159.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  160.                 [imageView setImage:img];
  161.                 [img release];
  162.                 break;
  163.             case 6:
  164.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  165.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  166.                 [imageView setImage:img];
  167.                 [img release];
  168.                 break;
  169.             case 7:
  170.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  171.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  172.                 [imageView setImage:img];
  173.                 [img release];
  174.                 break;
  175.             case 8:
  176.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  177.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  178.                 [imageView setImage:img];
  179.                 [img release];
  180.                 break;
  181.             case 9:
  182.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  183.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  184.                 [imageView setImage:img];
  185.                 [img release];
  186.                 break;
  187.             case 10:
  188.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  189.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  190.                 [imageView setImage:img];
  191.                 [img release];
  192.                 break;
  193.             case 11:
  194.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  195.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  196.                 [imageView setImage:img];
  197.                 [img release];
  198.                 break;
  199.             case 12:
  200.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  201.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  202.                 [imageView setImage:img];
  203.                 [img release];
  204.                 break;
  205.             case 13:
  206.                 img = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"w29_02_p.jpg" ofType:@"jpeg"]];
  207.                 [imageView setImage:img];
  208.                 [img release];
  209.                 break;
  210.             case 14:
  211.                 img = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"w29_02_p.jpg" ofType:@"jpeg"]];
  212.                 [imageView setImage:img];
  213.                 [img release];
  214.                 break;
  215.             case 15:
  216.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  217.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  218.                 [imageView setImage:img];
  219.                 [img release];
  220.                 break;
  221.             case 16:
  222.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  223.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  224.                 [imageView setImage:img];
  225.                 [img release];
  226.                 break;
  227.             case 17:
  228.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  229.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  230.                 [imageView setImage:img];
  231.                 [img release];
  232.                 break;
  233.             case 18:
  234.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  235.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  236.                 [imageView setImage:img];
  237.                 [img release];
  238.                 break;
  239.             case 19:
  240.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  241.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  242.                 [imageView setImage:img];
  243.                 [img release];
  244.                
  245.                 break;
  246.             case 20:
  247.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  248.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  249.                 [imageView setImage:img];
  250.                 [img release];
  251.                 break;
  252.             case 21:
  253.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  254.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  255.                 [imageView setImage:img];
  256.                 [img release];
  257.                 break;
  258.             case 22:
  259.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  260.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  261.                 [imageView setImage:img];
  262.                 [img release];
  263.                 break;
  264.             case 23:
  265.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  266.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  267.                 [imageView setImage:img];
  268.                 [img release];
  269.                 break;
  270.             case 24:
  271.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  272.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  273.                 [imageView setImage:img];
  274.                 [img release];
  275.                 break;
  276.             case 25:
  277.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  278.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  279.                 [imageView setImage:img];
  280.                 [img release];
  281.                 break;
  282.             case 26:
  283.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  284.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  285.                 [imageView setImage:img];
  286.                 [img release];
  287.                 break;
  288.             case 27:
  289.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  290.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  291.                 [imageView setImage:img];
  292.                 [img release];
  293.                 break;
  294.             case 28:
  295.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  296.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  297.                 [imageView setImage:img];
  298.                 [img release];
  299.                 break;
  300.             case 29:
  301.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  302.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  303.                 [imageView setImage:img];
  304.                 [img release];
  305.                 break;
  306.             case 30:
  307.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  308.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  309.                 [imageView setImage:img];
  310.                 [img release];
  311.                 break;
  312.             case 31:
  313.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  314.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  315.                 [imageView setImage:img];
  316.                 [img release];
  317.                
  318.                 break;
  319.             case 32:
  320.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  321.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  322.                 [imageView setImage:img];
  323.                 [img release];
  324.                 break;
  325.             case 33:
  326.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  327.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  328.                 [imageView setImage:img];
  329.                 [img release];
  330.                 break;
  331.             case 34:
  332.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  333.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  334.                 [imageView setImage:img];
  335.                 [img release];
  336.                 break;
  337.             case 35:
  338.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  339.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  340.                 [imageView setImage:img];
  341.                 [img release];
  342.                 break;
  343.             case 36:
  344.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  345.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  346.                 [imageView setImage:img];
  347.                 [img release];
  348.                
  349.                 break;
  350.             case 37:
  351.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  352.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  353.                 [imageView setImage:img];
  354.                 [img release];
  355.                 break;
  356.             case 38:
  357.                 img = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"w29_02_p.jpg" ofType:@"jpeg"]];
  358.                 [imageView setImage:img];
  359.                 [img release];
  360.                 break;
  361.             case 39:
  362.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  363.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  364.                 [imageView setImage:img];
  365.                 [img release];
  366.                 break;
  367.             case 40:
  368.                 img = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"w29_02_p.jpg" ofType:@"jpeg"]];
  369.                 [imageView setImage:img];
  370.                 [img release];
  371.                 break;
  372.             case 41:
  373.                 img = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"w29_02_p.jpg" ofType:@"jpeg"]];
  374.                 [imageView setImage:img];
  375.                 [img release];
  376.                 break;
  377.             case 42:
  378.                 img = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"w29_02_p.jpg" ofType:@"jpeg"]];
  379.                 [imageView setImage:img];
  380.                 [img release];
  381.                 break;
  382.                
  383.             case 43:
  384.                 img = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"w29_02_p.jpg" ofType:@"jpeg"]];
  385.                 [imageView setImage:img];
  386.                 [img release];
  387.                
  388.                 break;
  389.             case 44:
  390.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  391.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  392.                 [imageView setImage:img];
  393.                 [img release];
  394.                 break;
  395.             case 45:
  396.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  397.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  398.                 [imageView setImage:img];
  399.                 [img release];
  400.                 break;
  401.             case 46:
  402.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  403.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  404.                 [imageView setImage:img];
  405.                 [img release];
  406.                 break;
  407.             case 47:
  408.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  409.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  410.                 [imageView setImage:img];
  411.                 [img release];
  412.                 break;
  413.             case 48:
  414.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  415.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  416.                 [imageView setImage:img];
  417.                 [img release];
  418.                 break;
  419.             case 49:
  420.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  421.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  422.                 [imageView setImage:img];
  423.                 [img release];
  424.                 break;
  425.             case 50:
  426.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  427.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  428.                 [imageView setImage:img];
  429.                 [img release];
  430.                 break;
  431.             case 51:
  432.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  433.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  434.                 [imageView setImage:img];
  435.                 [img release];
  436.                 break;
  437.             case 52:
  438.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  439.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  440.                 [imageView setImage:img];
  441.                 [img release];
  442.                 break;
  443.             case 53:
  444.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  445.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  446.                 [imageView setImage:img];
  447.                 [img release];
  448.                 break;
  449.             case 54:
  450.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  451.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  452.                 [imageView setImage:img];
  453.                 [img release];
  454.                 break;
  455.             case 55:
  456.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  457.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  458.                 [imageView setImage:img];
  459.                 [img release];
  460.                 break;
  461.             case 56:
  462.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  463.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  464.                 [imageView setImage:img];
  465.                 [img release];
  466.                 break;
  467.             case 57:
  468.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  469.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  470.                 [imageView setImage:img];
  471.                 [img release];
  472.                 break;
  473.             case 58:
  474.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  475.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  476.                 [imageView setImage:img];
  477.                 [img release];
  478.                 break;
  479.             case 59:
  480.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  481.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  482.                 [imageView setImage:img];
  483.                 [img release];
  484.                 break;
  485.             case 60:
  486.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  487.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  488.                 [imageView setImage:img];
  489.                 [img release];
  490.                 break;
  491.             case 61:
  492.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  493.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  494.                 [imageView setImage:img];
  495.                 [img release];
  496.                 break;
  497.             case 62:
  498.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  499.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  500.                 [imageView setImage:img];
  501.                 [img release];
  502.                 break;
  503.             case 63:
  504.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  505.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  506.                 [imageView setImage:img];
  507.                 [img release];
  508.                 break;
  509.             case 64:
  510.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  511.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  512.                 [imageView setImage:img];
  513.                 [img release];
  514.                 break;
  515.             case 65:
  516.                 img = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"w29_02_p.jpg" ofType:@"jpeg"]];
  517.                 [imageView setImage:img];
  518.                 [img release];
  519.                 break;
  520.             case 66:
  521.                 img = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"w29_02_p.jpg" ofType:@"jpeg"]];
  522.                 [imageView setImage:img];
  523.                 [img release];
  524.                 break;
  525.             case 67:
  526.                 img = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"w29_02_p.jpg" ofType:@"jpeg"]];
  527.                 [imageView setImage:img];
  528.                 [img release];
  529.                 break;
  530.             case 68:
  531.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  532.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  533.                 [imageView setImage:img];
  534.                 [img release];
  535.                 break;
  536.             case 69:
  537.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  538.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  539.                 [imageView setImage:img];
  540.                 [img release];
  541.                 break;
  542.             case 70:
  543.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  544.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  545.                 [imageView setImage:img];
  546.                 [img release];
  547.                 break;
  548.             case 71:
  549.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  550.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  551.                 [imageView setImage:img];
  552.                 [img release];
  553.                
  554.                 break;
  555.             case 72:
  556.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  557.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  558.                 [imageView setImage:img];
  559.                 [img release];
  560.                
  561.                 break;
  562.             case 73:
  563.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  564.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  565.                 [imageView setImage:img];
  566.                 [img release];
  567.                 break;
  568.             case 74:
  569.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  570.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  571.                 [imageView setImage:img];
  572.                 [img release];
  573.                 break;
  574.             case 75:
  575.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  576.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  577.                 [imageView setImage:img];
  578.                 [img release];
  579.                 break;
  580.             case 76:
  581.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  582.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  583.                 [imageView setImage:img];
  584.                 [img release];
  585.                 break;
  586.             case 77:
  587.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  588.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  589.                 [imageView setImage:img];
  590.                 [img release];
  591.                 break;
  592.             case 78:
  593.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  594.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  595.                 [imageView setImage:img];
  596.                 [img release];
  597.                 break;
  598.             case 79:
  599.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  600.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  601.                 [imageView setImage:img];
  602.                 [img release];
  603.                 break;
  604.             case 80:
  605.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  606.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  607.                 [imageView setImage:img];
  608.                 [img release];
  609.                 break;
  610.             case 81:
  611.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  612.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  613.                 [imageView setImage:img];
  614.                 [img release];
  615.                 break;
  616.             case 82:
  617.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  618.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  619.                 [imageView setImage:img];
  620.                 [img release];
  621.                 break;
  622.             case 83:
  623.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  624.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  625.                 [imageView setImage:img];
  626.                 [img release];
  627.                 break;
  628.             case 84:
  629.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  630.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  631.                 [imageView setImage:img];
  632.                 [img release];
  633.                 break;
  634.             case 85:
  635.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  636.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  637.                 [imageView setImage:img];
  638.                 [img release];
  639.                 break;
  640.             case 86:
  641.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  642.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  643.                 [imageView setImage:img];
  644.                 [img release];
  645.                
  646.                 break;
  647.             case 87:
  648.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  649.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  650.                 [imageView setImage:img];
  651.                 [img release];
  652.                 break;
  653.             case 88:
  654.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  655.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  656.                 [imageView setImage:img];
  657.                 [img release];
  658.                 break;
  659.             case 89:
  660.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  661.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  662.                 [imageView setImage:img];
  663.                 [img release];
  664.                 break;
  665.             case 90:
  666.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  667.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  668.                 [imageView setImage:img];
  669.                 [img release];
  670.                 break;
  671.             case 91:
  672.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  673.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  674.                 [imageView setImage:img];
  675.                 [img release];
  676.                 break;
  677.                 img = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"w29_02_p.jpg" ofType:@"jpeg"]];
  678.                 [imageView setImage:img];
  679.                 [img release];
  680.             case 92:
  681.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  682.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  683.                 [imageView setImage:img];
  684.                 [img release];
  685.                 break;
  686.             case 93:
  687.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  688.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  689.                 [imageView setImage:img];
  690.                 [img release];
  691.                 break;
  692.             case 94:
  693.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  694.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  695.                 [imageView setImage:img];
  696.                 [img release];
  697.                 break;
  698.             case 95:
  699.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  700.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  701.                 [imageView setImage:img];
  702.                 [img release];
  703.                 break;
  704.             case 96:
  705.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  706.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  707.                 [imageView setImage:img];
  708.                 [img release];
  709.                 break;
  710.             case 97:
  711.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  712.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  713.                 [imageView setImage:img];
  714.                 [img release];
  715.                 break;
  716.             case 98:
  717.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  718.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  719.                 [imageView setImage:img];
  720.                 [img release];
  721.                 break;
  722.             case 99:
  723.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  724.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  725.                 [imageView setImage:img];
  726.                 [img release];
  727.                 break;
  728.             case 100:
  729.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  730.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  731.                 [imageView setImage:img];
  732.                 [img release];
  733.                 break;
  734.             case 101:
  735.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  736.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  737.                 [imageView setImage:img];
  738.                 [img release];
  739.                 break;
  740.             case 102:
  741.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  742.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  743.                 [imageView setImage:img];
  744.                 [img release];
  745.                 break;
  746.             case 103:
  747.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  748.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  749.                 [imageView setImage:img];
  750.                 [img release];
  751.                 break;
  752.             case 104:
  753.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  754.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  755.                 [imageView setImage:img];
  756.                 [img release];
  757.                 break;
  758.             case 105:
  759.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  760.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  761.                 [imageView setImage:img];
  762.                 [img release];
  763.                 break;
  764.             case 106:
  765.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  766.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  767.                 [imageView setImage:img];
  768.                 [img release];
  769.                 break;
  770.             case 107:
  771.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  772.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  773.                 [imageView setImage:img];
  774.                 [img release];
  775.                 break;
  776.             case 108:
  777.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  778.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  779.                 [imageView setImage:img];
  780.                 [img release];
  781.                 break;
  782.             case 109:
  783.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  784.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  785.                 [imageView setImage:img];
  786.                 [img release];
  787.                 break;
  788.             case 110:
  789.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  790.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  791.                 [imageView setImage:img];
  792.                 [img release];
  793.                 break;
  794.             case 111:
  795.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  796.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  797.                 [imageView setImage:img];
  798.                 [img release];
  799.                 break;
  800.             case 112:
  801.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  802.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  803.                 [imageView setImage:img];
  804.                 [img release];
  805.                 break;
  806.             case 113:
  807.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  808.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  809.                 [imageView setImage:img];
  810.                 [img release];
  811.                 break;
  812.             case 114:
  813.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  814.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  815.                 [imageView setImage:img];
  816.                 [img release];
  817.                
  818.                 break;
  819.             case 115:
  820.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  821.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  822.                 [imageView setImage:img];
  823.                 [img release];
  824.                 break;
  825.             case 116:
  826.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  827.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  828.                 [imageView setImage:img];
  829.                 [img release];
  830.                 break;
  831.             case 117:
  832.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  833.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  834.                 [imageView setImage:img];
  835.                 [img release];
  836.                 break;
  837.             case 118:
  838.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  839.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  840.                 [imageView setImage:img];
  841.                 [img release];
  842.                 break;
  843.                
  844.             case 119:
  845.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  846.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  847.                 [imageView setImage:img];
  848.                 [img release];
  849.                 break;
  850.             case 120:
  851.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  852.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  853.                 [imageView setImage:img];
  854.                 [img release];
  855.                 break;
  856.             case 121:
  857.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  858.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  859.                 [imageView setImage:img];
  860.                 [img release];
  861.                 break;
  862.             case 122:
  863.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  864.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  865.                 [imageView setImage:img];
  866.                 [img release];
  867.                 break;
  868.             case 123:
  869.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  870.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  871.                 [imageView setImage:img];
  872.                 [img release];
  873.                 break;
  874.             case 124:
  875.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  876.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  877.                 [imageView setImage:img];
  878.                 [img release];
  879.                 break;
  880.             case 125:
  881.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  882.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  883.                 [imageView setImage:img];
  884.                 [img release];
  885.                 break;
  886.             case 126:
  887.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  888.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  889.                 [imageView setImage:img];
  890.                 [img release];
  891.                 break;
  892.             case 127:
  893.                 path  = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"w29_capa_p.jpg"];
  894.                 img = [[UIImage alloc] initWithContentsOfFile:path];
  895.                 [imageView setImage:img];
  896.                 [img release];
  897.                 break;
  898.                
  899.                
  900.         }
  901.        
  902.         [scroll addSubview:imageView];
  903.         [imageView release];
  904.         countFlag++;
  905.     }
  906. }
  907.  
  908.  
  909. -(void) viewWillAppear:(BOOL)animated  {
  910.     listaImagens = [[NSMutableArray alloc]init];
  911.     //[self carregarListaDeImagens];
  912.     [self loadNextPage:0];
  913.     [self loadNextPage:1];
  914.    
  915.     // [scroll setMinimumZoomScale:1];
  916.     // [scroll setMaximumZoomScale:3];
  917.     //[scroll setZoomScale:0.5];
  918. }
  919.  
  920. -(void) viewWillDisappear:(BOOL)animated {
  921.     if (listaImagens)
  922.         [listaImagens release];
  923. }
  924.  
  925. -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
  926.     AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication]delegate];
  927.     if(toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
  928.         [appDelegate irRevistaLandscape:self comPagina:_paginaAtual];
  929.    
  930.     return YES;
  931. }
  932.  
  933. @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement