Take the username and password, and concat them together with a colon.  Take the resulting string and Base64 encode it.  Take the Base64 encoded string, and prepend "Basic " (with the space).  Now take that string (Basic [Base64 encoded value]) and set it as the "Authorization" header for your request.
Alternatively, if you're using the NSURLConnection delegate methods, you can implement one of them with something like:
- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
  NSURLCredential * credential = [NSURLCredential credentialWithUser:username password:password persistence:NSURLCredentialPersistenceForSession];
  [[challenge sender] useCredential:credential forAuthenticationChallenge:challenge];
}
(warning: untested, typed in a browser.  caveat implementor)