Example of sorting an NSArray NSArray *sortedArray = [array sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
Pages
Categories
Archives
Example of sorting an NSArray NSArray *sortedArray = [array sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
NSDateFormatter formatting strings. Sourced from this blog post. a: AM/PM A: 0~86399999 (Millisecond of Day) c/cc: 1~7 (Day of Week) ccc: Sun/Mon/Tue/Wed/Thu/Fri/Sat cccc: Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday d: 1~31 (0 padded Day of Month) D: 1~366 (0 padded Day of Year) e: 1~7 (0 padded Day of Week) E~EEE: Sun/Mon/Tue/Wed/Thu/Fri/Sat EEEE: Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday F: 1~5 [...]
To make an asynchronous HTTP POST request from your iPhone application with NSURLConnection: responseData = [[NSMutableData data] retain]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://www.domain.com/your/servlet"]]; NSString *params = [[NSString alloc] initWithFormat:@"foo=bar&key=value"]; [request setHTTPMethod:@"POST"]; [request setHTTPBody:[params dataUsingEncoding:NSUTF8StringEncoding]]; [[NSURLConnection alloc] initWithRequest:request delegate:self]; Use the – (void)connectionDidFinishLoading:(NSURLConnection *)connection method in your class to handle the response.
A JSON library for the iPhone. For more information and a tutorial visit http://www.mobileorchard.com/tutorial-json-over-http-on-the-iphone/ Get the latest version of the JSON framework Use the JSON framework: – (void)viewDidLoad { responseData = [[NSMutableData data] retain]; NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.server.com/jsonresponse"]]; [[NSURLConnection alloc] initWithRequest:request delegate:self]; [super viewDidLoad]; } – (void)connectionDidFinishLoading:(NSURLConnection *)connection { [connection release]; [...]
The basic methods to implement a UITableViewController class. self.listData references an array that holds the table data. DetailViewController is a UIViewController class that is pushed on to the view stack. #pragma mark – #pragma mark Table View Data Source Methods – (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [self.listData count]; } – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath [...]