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

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

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

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

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

Reply
 
LinkBack Thread Tools Display Modes
Old 09-24-2011, 10:29 AM   #1 (permalink)
Registered Member
 
headkaze's Avatar
 
Join Date: Feb 2010
Posts: 359
headkaze is on a distinguished road
Default Adding a UIWebView to an EAGLView

I don't have much experience with UIKit so I apologise in advance but I have an OpenGL game where I want to add a UIWebView to overlay some scrollable instructions. I am using the latest OpenGL ES template which has a UIViewController which has it's view set to EAGLView.

What I have done is a create a WebView.xib and added a UIWebView along with a UIToolbar. The UIToolbar has a "Back" button which when pressed will remove the view.

I have connected the UIWebView and UIToolbar using IB and connected the button to a press event.

I have created a new class called WebView which subclasses UIView and which is connected to the xib File's Owner.

Now in my ViewController I instanciate the WebView class like so.

Code:
webView = [[WebView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
I have a method in WebView which should animate the view in

Code:
- (void)addWebPageToView:(UIView *) view
{
	NSLog(@"addWebPageToView");
	
	[UIView beginAnimations:Nil context:NULL];
	[UIView setAnimationDuration:0.5];
	[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:view cache:YES];
	
	[view addSubview:self];
	
	[UIView commitAnimations];
}
To show it (from C++ code) I use the following method

Code:
void showInstructions(const string& fileName)
{
	MyAppDelegate *appDelegate = (MyAppDelegate *)[UIApplication sharedApplication].delegate;
	MyViewController *viewController = [appDelegate viewController];
	WebView *webView = viewController.webView;
	[webPage createWebView:[NSString stringWithUTF8String:fileName.c_str()]];
	[webView addWebPageToView:viewController.view];
}
The EAGLView does spin around like it's animating correctly but the view is never shown.
__________________
Headsoft | Jungool

Last edited by headkaze; 09-24-2011 at 11:22 AM.
headkaze is offline   Reply With Quote
Old 09-24-2011, 03:41 PM   #2 (permalink)
Registered Member
 
headkaze's Avatar
 
Join Date: Feb 2010
Posts: 359
headkaze is on a distinguished road
Default

I had to load the xib manually using

Code:
[[NSBundle mainBundle] loadNibNamed:@"WebView" owner:self options:nil];
Then implement an initWithCoder method instead of initWithFrame

Also I had to rename my WebView class to MyWebView because it is an internal framework class.
__________________
Headsoft | Jungool
headkaze is offline   Reply With Quote
Reply

Bookmarks

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: 392
11 members and 381 guests
7twenty7, apatsufas, comicool, Creativ, Dalia, dansparrow, Duncan C, HemiMG, Murphy, pbart, Tomsky
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,676
Threads: 94,127
Posts: 402,915
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jleannex55
Powered by vBadvanced CMPS v3.1.0

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