Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

eli8527

macrumors newbie
Original poster
Jul 18, 2008
25
0
Hi Everyone, I'm encountering a problem in my iPhone/iPad Application in which I have a UIToolbar as a subview of a UIWebView. However, when I add buttons to the toolbar, these buttons are not responsive... Any help would be much appreciated!

Here is my code:
Code:
- (void)viewDidLoad {
    [super viewDidLoad];
	
	resourcesViewController.scalesPageToFit = YES;
	
	[resourcesViewController loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"google.com"]]];
	
	//ToolBar Code
	toolbar = [[UIToolbar alloc] init];
	[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
	[toolbar sizeToFit];
	
	//Button Code
	studentDirectory = [[UIBarButtonItem alloc] initWithTitle:@"Student Directory" style:UIBarButtonItemStyleBordered target:self action:@selector(stuDir:)];
	passwordReset = [[UIBarButtonItem alloc] initWithTitle:@"Password Reset" style:UIBarButtonItemStyleBordered target:self action:@selector(resetPass:)];
	[toolbar setItems:[NSArray arrayWithObjects:studentDirectory,passwordReset,nil]];
	
	if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
	{
		// The device is an iPad running iPhone 3.2 or later.
	
       //Toolbar
		if ([[UIDevice currentDevice] orientation]	== UIDeviceOrientationPortrait || [[UIDevice currentDevice] orientation] == UIDeviceOrientationPortraitUpsideDown) {
			[toolbar setFrame:CGRectMake( 0, -31, 768, 31)];
			[resourcesViewController addSubview:toolbar];
		}
		else {
		[toolbar setFrame:CGRectMake( 0, -31, 1024, 31)];
			[resourcesViewController addSubview:toolbar];
		}
			
	}
	else
	{
		// The device is an iPhone or iPod touch.
		[toolbar setFrame:CGRectMake( 0, -32, 320, 32)];
		[resourcesViewController addSubview:toolbar];
	}
	

	
	

}

-(void)resetPass:(id)sender {
	NSLog(@"I WAS PRESSED :D");
	[resourcesViewController loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"google.com"]]];

}
	
-(void)stuDir:(id)sender {
	NSLog(@"I WAS PRESSED :D");
	[resourcesViewController loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"google.com"]]];
}
 
I've actually been wondering the same thing! I'd like to create a bookmarks-toolbar sort of thing as a subview of a UIWebView (like Mobile Safari), but I've not been able to figure out how. Any thoughts on this would be appreciated.... thanks!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.