I have a rotating banner at the bottom of my app displaying advertisments, when the user clicks on a rotation a viewcontroller with a simple webview and a toolbar on at the top is display showing a webpage specific to the banner. this all works fine apart from i need a close button in the toolbar. For some reason after i linked the close button to an action that should show 'close' in the log when clicked. i run the app and click the button and a bad access error occurs without a message in the error log.
This is where the viewcontroller with the webview is shown. It is called from a method in the app delegate that can be accessed from anywhere in the app.
BannerViewer* viewer = [BannerViewer alloc];
[viewer setUrl:db.WEBurl];
[_window addSubview: viewer.view];
BannerViewer.h
@interface BannerViewer : UIViewController {
IBOutlet UIWebView* webView;
IBOutlet UIBarButtonItem* close;
IBOutlet UINavigationBar* navBar;
NSURL *url;
}
@property(nonatomic,strong)IBOutlet UIWebView* webView;
@property(nonatomic,strong)NSURL *url;
@property(nonatomic,strong)IBOutlet UIBarButtonItem* close;
@property(nonatomic,strong)IBOutlet UINavigationBar* navBar;
-(IBAction)closeWindow:(id)sender;
@end
BannerViewer.m
-(IBAction)closeWindow:(id)sender{
NSLog(@"close");
}
Thanks for any help in advance!