16
Jul
I updated and open-sourced a utility for downloading web-hosted files for iOS today. Using it is extremely easy and doesn't require any notifications or delegates. Only sexy block syntax.
First, you'll need to import it in your implementation file:
#import "RemoteDataManager.h"
Then you can:
NSString *location = @"http://tailsmagazines.files.wordpress.com/2009/04/kitten.jpg?w=320&h=480"; [[RemoteDataManager sharedManager] getDataAtLocation:location withCallback:^(BOOL waiting, NSData *data){ if(waiting){
The key thing to acknowledge here is that the Callback block may get
10
Oct
The right way to use NSOperation, NSOperationQueue and NSURLConnection
I stumbled across a problem today when trying to make an asynchronous POST request to a server.
I created a request class by subclassing NSOperation and was calling it by adding it to an NSOperationQueue (more here) and within this class's (void)main method, I was creating an NSURLConnection like this:
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self]
The problem I was experiencing was none of the NSURLConnection delegate callbacks were being fired.
After a little research I realized that when you create an NSURLConnection using the initWithRequest
12
Feb
Wouldn't it be great if you could change the frame of the media player? If you could take the full screen window and fit it in a custom CGRect and place it where-ever you want on the window?
Well, you can, but it's undocumented, so hack at your own risk, but here's how.
First thing you should know is you can't hack the window until you start playing the video. Once you issue the play command to the MediaPlayer framework, it adds a new window to the window stack. So - you have to find it:
NSArray *windows
12
Feb
Apparently, the most popular way to do this is with NSMenuExtra, an undocumented class.
Here's a howto from 2003 on using it. I'm wondering why Apple has found it necessary to leave this class undocumented for over 6 years without changing it. Nevertheless, enjoy.