Skip to content

Instantly share code, notes, and snippets.

@devongovett
Created October 13, 2008 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devongovett/16559 to your computer and use it in GitHub Desktop.
Save devongovett/16559 to your computer and use it in GitHub Desktop.
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