Created
October 13, 2008 16:56
-
-
Save devongovett/16559 to your computer and use it in GitHub Desktop.
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
webView = [[CPWebView alloc] initWithFrame:CGRectMake(199,0,(CGRectGetWidth(bounds)-199),CGRectGetHeight(bounds))]; | |
[webView setAutoresizingMask: CPViewWidthSizable | CPViewHeightSizable]; | |
[webView loadHTMLString:@"<center><h3>Tmp String</h3></p>"]; | |
[contentView addSubview:webView]; | |
var request = [CPURLRequest requestWithURL:"Your URL Here!"]; | |
listConnection = [CPURLConnection connectionWithRequest:request delegate:self]; | |
//delegate methods | |
- (void)connection:(CPURLConnection) aConnection didReceiveData:(CPString)data | |
{ | |
if (aConnection == listConnection){ | |
//Do stuff with data | |
} | |
[self clearConnection: aConnection]; | |
} | |
- (void)connection:(CPURLConnection)aConnection didFailWithError:(CPString)error | |
{ | |
alert("Could not load"); | |
[self clearConnection:aConnection]; | |
} | |
- (void)clearConnection:(CPURLConnection)aConnection | |
{ | |
//we no longer need to hold on to a reference to this connection | |
if (aConnection == listConnection) | |
listConnection = nil; | |
} | |
-(void)connectionDidFinishLoading:(CPURLConnection)aConnection | |
{ | |
//Here is what happens when the connection is complete | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment