Created
March 6, 2012 09:34
-
-
Save anonymous/1985310 to your computer and use it in GitHub Desktop.
UIView
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // NACommentsView.m | |
| // NewspaperApp | |
| // | |
| // Created by MBP on 3/6/12. | |
| // Copyright (c) 2012 Knowledgeview Ltd. All rights reserved. | |
| // | |
| #import "NACommentsView.h" | |
| #import "NSBundle+Helpers.h" | |
| #import "MBProgressHUD.h" | |
| @implementation NACommentsView | |
| @synthesize delegate; | |
| @synthesize webView; | |
| @synthesize urlString; | |
| +(id) commentsView | |
| { | |
| return [[NSBundle mainBundle] loadObjectFromNibNamed:@"NACommentView" class:[self class] owner:nil options:nil]; | |
| } | |
| #pragma mark - View | |
| -(void)awakeFromNib | |
| { | |
| if (urlString != nil && [urlString length] > 0) | |
| { | |
| [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.urlString]]]; | |
| } | |
| } | |
| //-------------------------- | |
| // Actions | |
| //-------------------------- | |
| #pragma mark - Actions | |
| - (IBAction)backAction:(id)sender | |
| { | |
| [delegate commentsViewDidSelectBackButton:self]; | |
| } | |
| //-------------------------- | |
| //UIWebView Delegate Methode | |
| //-------------------------- | |
| #pragma mark - UIWebViewDelegate | |
| -(void)webViewDidStartLoad:(UIWebView *)webView | |
| { | |
| MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self animated:YES]; | |
| hud.labelText = @"Opening the Page"; | |
| } | |
| -(void)webViewDidFinishLoad:(UIWebView *)webView | |
| { | |
| [MBProgressHUD hideHUDForView:self animated:YES]; | |
| } | |
| -(void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error | |
| { | |
| if ([self.delegate respondsToSelector:@selector(commentsView:DidFailWithError:)]) | |
| [delegate commentsView:self DidFailWithError:error]; | |
| } | |
| //-------------------------- | |
| // Memory Management | |
| //-------------------------- | |
| #pragma mark - Memory Management | |
| - (void)dealloc { | |
| [webView release]; | |
| [delegate release]; | |
| [urlString release]; | |
| [super dealloc]; | |
| } | |
| @end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment