Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-25-2010, 06:30 PM   #1 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 20
Smile how to make a Document menu

1.my app currently has a password screen at start

2.after correct password is entered it goes to a UIWebView that loads a local PDF document

THE QUESTION?

if i put some buttons at the top of the UIWebView. how would i make it so that each button loads a different local PDF into the UIWebView???

would love to know how, i'm new so any code would be greatly appreciated,


here is my code..any ideas?


#import "YearbookViewController.h"
@implementation YearbookViewController

@synthesize webView, pdfUrl;


- (void)viewDidLoad{


UIAlertView *prompt = [[UIAlertView alloc] initWithTitle:@"Password"
message:@"n/n/n/" // IMPORTANT
delegate:self
cancelButtonTitle:nil
otherButtonTitles:@"Enter", nil];


textField2 = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 25.0)];
[textField2 setBackgroundColor:[UIColor whiteColor]];
[textField2 setPlaceholder:@"password"];
[textField2 setSecureTextEntry:YES];
[prompt addSubview:textField2];

// set place
[prompt setTransform:CGAffineTransformMakeTranslation(0.0, 115.0)];
[prompt show];
[prompt release];


// set cursor and show keyboard


[super viewDidLoad];
webView.scalesPageToFit=YES;
webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
NSString *pdfPath = [[NSBundle mainBundle] pathForResource:@"2009EVFalcon" ofType:@"pdf"];

/*
If we have to take from its operational directory, then the next 4 lines will be used...

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDire ctory, NSUserDomainMask, YES);
NSString *saveDirectory = [paths objectAtIndex:0];
NSString *saveFileName = @"myPDF.pdf";
NSString *pdfPath = [saveDirectory stringByAppendingPathComponent:saveFileName];
*/
self.pdfUrl = [NSURL fileURLWithPath:pdfPath];
[webView loadRequest:[NSURLRequest requestWithURL:pdfUrl]];
}


- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if ([textField2.text isEqualToString: @"MyPassword"]) {
}
else{
UIAlertView *prompt = [[UIAlertView alloc] initWithTitle:@"Password"
message:@"n/n/n/" // IMPORTANT
delegate:self
cancelButtonTitle:nil
otherButtonTitles:@"Enter", nil];


textField2 = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 25.0)];
[textField2 setBackgroundColor:[UIColor whiteColor]];
[textField2 setPlaceholder:@"password"];
[textField2 setSecureTextEntry:YES];
[prompt addSubview:textField2];

// set place
[prompt setTransform:CGAffineTransformMakeTranslation(0.0, 115.0)];
[prompt show];
[prompt release];


// set cursor and show keyboard
[textField2 becomeFirstResponder];
}

}



- (void)dealloc
{
[webView release];
[pdfUrl release];
[super dealloc];
}
@end
evfalcon is offline   Reply With Quote
Reply

Bookmarks

Tags
documents, nsstring, pdf, uibutton, uiwebview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 355
21 members and 334 guests
ADY, Dani77, Duncan C, e2applets, HemiMG, Herbie, JasonR, keeshux, linkmx, macquitzon216, mer10, Monstertaco, prchn4christ, Promo Dispenser, Robiwan, sebasx, sly24, Touchmint, twerner, zulfishah
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,881
Threads: 89,228
Posts: 380,760
Top Poster: BrianSlick (7,129)
Welcome to our newest member, macquitzon216
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:36 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0