Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
webview
- (void)openPdfWebview:(NSString *)linkUrl
{
pdfWebViewController= [[PdfWebViewController alloc] initWithNibName:@"PdfWebViewController" bundle:[NSBundle mainBundle]];
[pdfWebViewController setupUrlLink:linkUrl];
[pdfWebViewController.view setFrame:CGRectMake(0, 0, sview.view.frame.size.width, sview.view.frame.size.height)];
sview.view.userInteractionEnabled = true;
[sview.view addSubview:pdfWebViewController.view];
[pdfWebViewController viewWillAppear:NO];
[UIView animateWithDuration:0.5f animations:^{ [pdfWebViewController.view setAlpha:1.0f]; } completion:nil];
}
#import <UIKit/UIKit.h>
@interface PdfWebViewController : UIViewController
@property (strong, nonatomic) IBOutlet UIWebView *webview;
@property (strong, nonatomic) IBOutlet UIView *mainview;
@property (strong, nonatomic) NSString *urlpdfLink;
-(void)setupUrlLink:(NSString*)urlLink;
@end
#import "PdfWebViewController.h"
@interface PdfWebViewController ()
@end
@implementation PdfWebViewController
@synthesize webview;
@synthesize mainview;
- (void)viewDidLoad {
self.view.userInteractionEnabled = true;
mainview.userInteractionEnabled = true;
[self becomeFirstResponder];
[super viewDidLoad];
[self loadWeview];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (void)loadWeview{
// NSUserDefaults *df = [NSUserDefaults standardUserDefaults];
// NSString *url = self.urlpdfLink;
NSURL *nsurl=[NSURL URLWithString:self.urlpdfLink];
NSURLRequest *nsrequest=[NSURLRequest requestWithURL:nsurl];
[webview loadRequest:nsrequest];
[webview setFrame:CGRectMake(0, 0, mainview.frame.size.width, mainview.frame.size.height-40)];
[mainview addSubview:webview];
}
-(void)setupUrlLink:(NSString*)urlLink{
self.urlpdfLink = urlLink;
}
- (IBAction)tapClose:(id)sender {
[UIView animateWithDuration:0.2f
delay:0.0f
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
[self.view setAlpha:0.0f];
}
completion:nil];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment