2011-07-03 5 views
0

Im essayant de construire une application facile avec vue swiching et UIWebView il a travaillé jusqu'à ce que je l'ai écrit UIWebViewDiscussion 1: le signal reçu Programm: "SIGABRT"

-(IBAction)pushButton { 

    TermineViewController *screen = [[TermineViewController alloc] initWithNibName:nil bundle:nil]; 
    screen.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
    [self presentModalViewController:screen animated:YES]; thread 1: program receved signal: "SIGaBRT" 
    [screen release]; 
} 

-(IBAction)pushButton2 { 

    SpeiseplanViewController *screen = [[SpeiseplanViewController alloc] initWithNibName:nil bundle:nil]; 
    screen.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
    [self presentModalViewController:screen animated:YES]; 
    [screen release]; 




// 
// TermineViewController.m 
// LhAppv3 
// 
// Created by joan on 03.07.11. 
// Copyright 2011 __MyCompanyName__. All rights reserved. 
// 

#import "TermineViewController.h" 


@implementation TermineViewController 

-(IBAction)pushBack { 

    [self dismissModalViewControllerAnimated:YES]; 

} 

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 
{ 
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 
    if (self) { 
     // Custom initialization 
    } 
    return self; 
} 

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

- (void)didReceiveMemoryWarning 
{ 
    // Releases the view if it doesn't have a superview. 
    [super didReceiveMemoryWarning]; 

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

#pragma mark - View lifecycle 

/* 
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. 
- (void)viewDidLoad 
{ 
[super viewDidLoad]; 
} 
*/ 

-(void)viewDidLoad { 

    [super viewDidLoad]; 
    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.landheim-schondorf.de/news/"]]]; 
    [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(checkLoad) userInfo:nil repeats:YES]; 
    [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(checkNotLoad) userInfo:nil repeats:YES]; 

} 

-(void)checkLoad { 

    if(webView.loading) { 
     [active startAnimating]; 

    } 

} 

-(void)ckeckNotLoad { 

    if(!(webView.loading)) { 
     [active stopAnimating]; 

    } 

} - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    // Return YES for supported orientations 
    return (interfaceOrientation == UIInterfaceOrientationPortrait); 
} 

@end 


// 
// TermineViewController.h 
// LhAppv3 
// 
// Created by joan on 03.07.11. 
// Copyright 2011 __MyCompanyName__. All rights reserved. 
// 

#import <UIKit/UIKit.h> 


@interface TermineViewController : UIViewController { 

    IBOutlet UIWebView *webView; 
    IBOutlet UIActivityIndicatorView *active; 
} 

-(IBAction)pushBack; 

@end 
+0

S'il vous plaît afficher les trace de la pile de l'accident ou le code de _TermineViewController_. C'est probablement là que la cause de l'erreur est. – Codo

+0

le code du fichier .h ou .m ???? – joan

+0

'le code du .h ou .m ????' -> les deux – vikingosegundo

Répondre

1

Vous n'êtes pas en train de créer une vue.

-(void)viewDidLoad { 
    [super viewDidLoad]; 
    webView = [[UIWebView alloc] initWithFrame:aRect]; //<-------- 
    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.landheim-schondorf.de/news/"]]]; 
    [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(checkLoad) userInfo:nil repeats:YES]; 
    [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(checkNotLoad) userInfo:nil repeats:YES]; 

} 

En outre, vous devez libérer webView dans dealloc. Et vous devriez vous sentir à l'aise avec les propriétés.

modifier
essayer d'attraper le virus avec l'aide de zombies: NSZombieEnabled

+0

ok ce que shoult j'écris maintenant ?? – joan

+0

Je viens de travailler avec ces deux tutoriels: http://www.youtube.com/watch?v=3P7sadlxBuQ http://www.youtube.com/watch?v=3P7sadlxBuQ – joan

+0

wirklich gute docs: http: // stackoverflow. com/questions/5656626/apprentissage-iphone-sdk-objectif-c/5656783 # 5656783 Besonders Stanford mit Hagerty (Mais nous devons parler anglais: D) – vikingosegundo

Questions connexes