PageRenderTime 27ms CodeModel.GetById 19ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/iPhoneSample/Classes/TreeViewController.m

http://fskit.googlecode.com/
Objective C | 96 lines | 45 code | 18 blank | 33 comment | 2 complexity | 5206edbc2f8e50ce201b0311eca49e01 MD5 | raw file
Possible License(s): BSD-3-Clause
 1//
 2//  TreeViewController.m
 3//  iPhoneSample
 4//
 5//  Created by Logan Allred on 3/2/09.
 6//  Copyright 2009 RedBugz Software. All rights reserved.
 7//
 8
 9#import "TreeViewController.h"
10#import <FSKit/FSKit.h>
11#import "TreeView.h"
12
13@implementation TreeViewController
14
15/*
16// The designated initializer. Override to perform setup that is required before the view is loaded.
17- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
18    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
19        // Custom initialization
20    }
21    return self;
22}
23*/
24
25/*
26// Implement loadView to create a view hierarchy programmatically, without using a nib.
27- (void)loadView {
28}
29*/
30
31
32// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
33- (void)viewDidLoad {
34    [super viewDidLoad];
35 // Make a request
36 //	 FSKIdentityService *identityService = [[FSKIdentityService identityServiceWithConnection:connection delegate:self] retain];
37 //	 [identityService loginWithCredential:[NSURLCredential credentialWithUser:@"api-user-1009" password:@"f8cc" persistence:NSURLCredentialPersistenceForSession]];
38 
39 FSKPersonService *personService = [[FSKPersonService
40 personServiceWithConnection:[FSKConnection sharedConnection] 
41 delegate:self] retain];
42 [personService readPerson:@""];
43 
44 //	 [FSKPersonSearchRequest 
45 //	  fetchSearchResultsWithCriteria:nil connection:connection 
46 //	  delegate:self 
47 //	  selector:@selector(request:didReturnResponse:)];
48 //Handle the response by overriding these 2 methods in your delegate
49 }
50
51- (void)request:(FSKRequest *)request 
52didReturnResponse:(FSKResponse *)response
53{
54	NSLog(@"%s", _cmd);
55	if ([response isKindOfClass:[FSKPersonResponse class]])
56	{
57		FSKPersonResponse *resp = (FSKPersonResponse *)response;
58		[self setPerson:[resp person]];
59	}
60}
61- (void)request:(FSKRequest *)request 
62didFailWithError:(FSKError *)error
63{
64	NSLog(@"%s", _cmd);
65}
66
67- (void)setPerson:(FSKPerson *)person
68{
69	if ([person personId]) {
70	personIdLabel.text = [person personId];
71	}
72	nameLabel.text = [person fullName];
73//	birthLabel.text = [[resp summary] birthdate];
74	[treeView setRootPerson:person];
75	[treeView setNeedsDisplay];
76
77}
78
79- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
80	// Return YES for supported orientations
81	return YES;//(interfaceOrientation == UIInterfaceOrientationPortrait);
82}
83
84
85- (void)didReceiveMemoryWarning {
86	[super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
87	// Release anything that's not essential, such as cached data
88}
89
90
91- (void)dealloc {
92	[super dealloc];
93}
94
95
96@end