Advertisement
Guest User

Untitled

a guest
Apr 21st, 2014
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.02 KB | None | 0 0
  1. @synthesize datiLista,aggiornare,caricaTesto,Lista,webView,oggetto,ricetta_Aggiunta,Archivio_commenti;
  2.  
  3.  
  4. - (void)viewDidLoad
  5. {
  6. [super viewDidLoad];
  7. // Do any additional setup after loading the view.
  8.  
  9.  
  10. NSURLRequest *req = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:@"http://**************.altervista.org/feed/"]];
  11. [RSSParser parseRSSFeedForRequest:req success:^(NSArray *feedItems) {
  12.  
  13. [self setDatiLista:feedItems];
  14.  
  15.  
  16. oggetto= [datiLista objectAtIndex:0];
  17. NSLog(@"%@",oggetto.titolo); //object full
  18.  
  19. } failure:^(NSError *error) {
  20.  
  21. NSLog(@"Error: %@",error);
  22. }];
  23.  
  24.  
  25. NSLog(@"%@",oggetto.titolo); // object empty
  26.  
  27. vedi_commenti = [[ViewController_Laterale alloc]initWithNibName:nil bundle:nil];
  28. vedi_Internet = [[Vista_Stato_Internet alloc]initWithNibName:nil bundle:nil];
  29.  
  30.  
  31.  
  32.  
  33. webView= [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, 320, 570)];
  34. [webView setDelegate:self];
  35.  
  36. if( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone ){
  37.  
  38. NSString *htmlString =[NSString stringWithFormat:@"<html> n"
  39.  
  40.  
  41.  
  42.  
  43. "<head> n"
  44. "<style type="text/css"> n"
  45. "body {font-family: "%@"; font-size: %@;color: #808080;}n"
  46. "</style> n"
  47. "</head> n"
  48. // "<center><img src='%@'/ alt='' style='max-width:250px;'></center>" //immagine
  49. "<center><h2>%@</h2></center>n" //titolo
  50. "<center><body>%@</body></center></html>" ,@"futura",[NSNumber numberWithInt:50],@"futura",[NSNumber numberWithInt:45],oggetto.titolo,oggetto.contenuto_Intero];
  51.  
  52.  
  53.  
  54.  
  55. [webView setScalesPageToFit:YES];
  56.  
  57.  
  58.  
  59. [webView loadHTMLString:htmlString baseURL:nil];
  60.  
  61. [self.view addSubview:webView];
  62. [webView addSubview:aggiornare];
  63. [webView addSubview:caricaTesto];
  64.  
  65. }
  66.  
  67.  
  68.  
  69.  
  70.  
  71. -(void)ricaricaHome:(id)sender{
  72.  
  73. NSLog(@"%@",oggetto.titolo); // object full
  74.  
  75. datiLista=nil;
  76.  
  77.  
  78. NSURLRequest *req = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:@"http://*********.altervista.org/feed/"]];
  79. [RSSParser parseRSSFeedForRequest:req success:^(NSArray *feedItems) {
  80.  
  81. [self setDatiLista:feedItems];
  82.  
  83.  
  84. oggetto= [datiLista objectAtIndex:0];
  85.  
  86.  
  87. } failure:^(NSError *error) {
  88.  
  89. NSLog(@"Error: %@",error);
  90. }];
  91.  
  92. }
  93.  
  94.  
  95.  
  96.  
  97. - (void)vista_Commenti:(id)sender {
  98.  
  99. NSLog(@"%@",oggetto.titolo); // object full
  100.  
  101. NSNumberFormatter *form=[[NSNumberFormatter alloc]init];
  102.  
  103.  
  104. [vedi_commenti mostra_SlideConMessaggio:@"Commenti:" Conteggio:[form stringFromNumber:oggetto.Conteggio_commenti]];
  105.  
  106.  
  107.  
  108. [self.revealSideViewController pushViewController:vedi_commenti onDirection:PPRevealSideDirectionRight animated:YES];
  109.  
  110.  
  111. }
  112.  
  113.  
  114.  
  115. -(void)vista_WiFi:(id)sender{
  116.  
  117. NSLog(@"%@",oggetto.titolo); // object full
  118.  
  119. [self.revealSideViewController pushViewController:vedi_Internet onDirection:PPRevealSideDirectionLeft animated:YES];
  120.  
  121. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement