diff options
| author | mo khan <mo@mokhan.ca> | 2013-07-14 16:44:08 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2013-07-14 16:44:08 -0600 |
| commit | b6cafe275471e420c92eeea7b035ac8719b35884 (patch) | |
| tree | 401f28e142c84223de73d9f2f0ab0a73d953dda1 /cakeside-ios | |
| parent | 0513090d468f523e2ddda8b6589903298773197e (diff) | |
use a navigation controller to transition to the next controller after logging in
Diffstat (limited to 'cakeside-ios')
| -rw-r--r-- | cakeside-ios/AppDelegate.h | 2 | ||||
| -rw-r--r-- | cakeside-ios/AppDelegate.m | 5 | ||||
| -rw-r--r-- | cakeside-ios/controllers/CreationsTableViewController.h | 13 | ||||
| -rw-r--r-- | cakeside-ios/controllers/CreationsTableViewController.m | 124 | ||||
| -rw-r--r-- | cakeside-ios/controllers/CreationsTableViewController.xib | 160 | ||||
| -rw-r--r-- | cakeside-ios/controllers/LoginViewController.m | 5 |
6 files changed, 306 insertions, 3 deletions
diff --git a/cakeside-ios/AppDelegate.h b/cakeside-ios/AppDelegate.h index 8cbeda4..195c98d 100644 --- a/cakeside-ios/AppDelegate.h +++ b/cakeside-ios/AppDelegate.h @@ -15,5 +15,5 @@ @property (strong, nonatomic) UIWindow *window; @property (strong, nonatomic) LoginViewController *viewController; - +@property (strong, nonatomic) UINavigationController * navigationController; @end diff --git a/cakeside-ios/AppDelegate.m b/cakeside-ios/AppDelegate.m index 2b4d4ea..5e46599 100644 --- a/cakeside-ios/AppDelegate.m +++ b/cakeside-ios/AppDelegate.m @@ -16,8 +16,9 @@ { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. - self.viewController = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil]; - self.window.rootViewController = self.viewController; + self.viewController = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil]; + self.navigationController = [[UINavigationController alloc] initWithRootViewController:self.viewController]; + self.window.rootViewController = self.navigationController; [self.window makeKeyAndVisible]; return YES; } diff --git a/cakeside-ios/controllers/CreationsTableViewController.h b/cakeside-ios/controllers/CreationsTableViewController.h new file mode 100644 index 0000000..03529ed --- /dev/null +++ b/cakeside-ios/controllers/CreationsTableViewController.h @@ -0,0 +1,13 @@ +// +// CreationsTableViewController.h +// cakeside-ios +// +// Created by mo khan on 2013-07-14. +// Copyright (c) 2013 mo khan. All rights reserved. +// + +#import <UIKit/UIKit.h> + +@interface CreationsTableViewController : UITableViewController + +@end diff --git a/cakeside-ios/controllers/CreationsTableViewController.m b/cakeside-ios/controllers/CreationsTableViewController.m new file mode 100644 index 0000000..0299f05 --- /dev/null +++ b/cakeside-ios/controllers/CreationsTableViewController.m @@ -0,0 +1,124 @@ +// +// CreationsTableViewController.m +// cakeside-ios +// +// Created by mo khan on 2013-07-14. +// Copyright (c) 2013 mo khan. All rights reserved. +// + +#import "CreationsTableViewController.h" + +@interface CreationsTableViewController () + +@end + +@implementation CreationsTableViewController + +- (id)initWithStyle:(UITableViewStyle)style +{ + self = [super initWithStyle:style]; + if (self) { + // Custom initialization + } + return self; +} + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + // Uncomment the following line to preserve selection between presentations. + // self.clearsSelectionOnViewWillAppear = NO; + + // Uncomment the following line to display an Edit button in the navigation bar for this view controller. + // self.navigationItem.rightBarButtonItem = self.editButtonItem; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ +#warning Potentially incomplete method implementation. + // Return the number of sections. + return 0; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ +#warning Incomplete method implementation. + // Return the number of rows in the section. + return 0; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + static NSString *CellIdentifier = @"Cell"; + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; + if (cell == nil) { + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; + } + + // Configure the cell... + + return cell; +} + +/* +// Override to support conditional editing of the table view. +- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath +{ + // Return NO if you do not want the specified item to be editable. + return YES; +} +*/ + +/* +// Override to support editing the table view. +- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath +{ + if (editingStyle == UITableViewCellEditingStyleDelete) { + // Delete the row from the data source + [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; + } + else if (editingStyle == UITableViewCellEditingStyleInsert) { + // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view + } +} +*/ + +/* +// Override to support rearranging the table view. +- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath +{ +} +*/ + +/* +// Override to support conditional rearranging of the table view. +- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath +{ + // Return NO if you do not want the item to be re-orderable. + return YES; +} +*/ + +#pragma mark - Table view delegate + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + // Navigation logic may go here. Create and push another view controller. + /* + <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil]; + // ... + // Pass the selected object to the new view controller. + [self.navigationController pushViewController:detailViewController animated:YES]; + */ +} + +@end diff --git a/cakeside-ios/controllers/CreationsTableViewController.xib b/cakeside-ios/controllers/CreationsTableViewController.xib new file mode 100644 index 0000000..f194b3b --- /dev/null +++ b/cakeside-ios/controllers/CreationsTableViewController.xib @@ -0,0 +1,160 @@ +<?xml version="1.0" encoding="UTF-8"?> +<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00"> + <data> + <int key="IBDocument.SystemTarget">1552</int> + <string key="IBDocument.SystemVersion">12E55</string> + <string key="IBDocument.InterfaceBuilderVersion">3084</string> + <string key="IBDocument.AppKitVersion">1187.39</string> + <string key="IBDocument.HIToolboxVersion">626.00</string> + <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> + <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="NS.object.0">2083</string> + </object> + <array key="IBDocument.IntegratedClassDependencies"> + <string>IBProxyObject</string> + <string>IBUITableView</string> + </array> + <array key="IBDocument.PluginDependencies"> + <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + </array> + <object class="NSMutableDictionary" key="IBDocument.Metadata"> + <string key="NS.key.0">PluginDependencyRecalculationVersion</string> + <integer value="1" key="NS.object.0"/> + </object> + <array class="NSMutableArray" key="IBDocument.RootObjects" id="1000"> + <object class="IBProxyObject" id="372490531"> + <string key="IBProxiedObjectIdentifier">IBFilesOwner</string> + <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> + </object> + <object class="IBProxyObject" id="975951072"> + <string key="IBProxiedObjectIdentifier">IBFirstResponder</string> + <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> + </object> + <object class="IBUITableView" id="873029372"> + <reference key="NSNextResponder"/> + <int key="NSvFlags">274</int> + <string key="NSFrame">{{0, 20}, {320, 548}}</string> + <reference key="NSSuperview"/> + <reference key="NSWindow"/> + <reference key="NSNextKeyView"/> + <object class="NSColor" key="IBUIBackgroundColor"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MQA</bytes> + </object> + <bool key="IBUIOpaque">NO</bool> + <bool key="IBUIClipsSubviews">YES</bool> + <bool key="IBUIClearsContextBeforeDrawing">NO</bool> + <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/> + <object class="IBUIScreenMetrics" key="IBUISimulatedDestinationMetrics"> + <string key="IBUISimulatedSizeMetricsClass">IBUIScreenMetrics</string> + <object class="NSMutableDictionary" key="IBUINormalizedOrientationToSizeMap"> + <bool key="EncodedWithXMLCoder">YES</bool> + <array key="dict.sortedKeys"> + <integer value="1"/> + <integer value="3"/> + </array> + <array key="dict.values"> + <string>{320, 568}</string> + <string>{568, 320}</string> + </array> + </object> + <string key="IBUITargetRuntime">IBCocoaTouchFramework</string> + <string key="IBUIDisplayName">Retina 4 Full Screen</string> + <int key="IBUIType">2</int> + </object> + <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> + <bool key="IBUIBouncesZoom">NO</bool> + <int key="IBUISeparatorStyle">1</int> + <int key="IBUISectionIndexMinimumDisplayRowCount">0</int> + <bool key="IBUIShowsSelectionImmediatelyOnTouchBegin">YES</bool> + <float key="IBUIRowHeight">44</float> + <float key="IBUISectionHeaderHeight">22</float> + <float key="IBUISectionFooterHeight">22</float> + </object> + </array> + <object class="IBObjectContainer" key="IBDocument.Objects"> + <array class="NSMutableArray" key="connectionRecords"> + <object class="IBConnectionRecord"> + <object class="IBCocoaTouchOutletConnection" key="connection"> + <string key="label">view</string> + <reference key="source" ref="372490531"/> + <reference key="destination" ref="873029372"/> + </object> + <int key="connectionID">5</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBCocoaTouchOutletConnection" key="connection"> + <string key="label">dataSource</string> + <reference key="source" ref="873029372"/> + <reference key="destination" ref="372490531"/> + </object> + <int key="connectionID">6</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBCocoaTouchOutletConnection" key="connection"> + <string key="label">delegate</string> + <reference key="source" ref="873029372"/> + <reference key="destination" ref="372490531"/> + </object> + <int key="connectionID">7</int> + </object> + </array> + <object class="IBMutableOrderedSet" key="objectRecords"> + <array key="orderedObjects"> + <object class="IBObjectRecord"> + <int key="objectID">0</int> + <array key="object" id="0"/> + <reference key="children" ref="1000"/> + <nil key="parent"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-1</int> + <reference key="object" ref="372490531"/> + <reference key="parent" ref="0"/> + <string key="objectName">File's Owner</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-2</int> + <reference key="object" ref="975951072"/> + <reference key="parent" ref="0"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">4</int> + <reference key="object" ref="873029372"/> + <reference key="parent" ref="0"/> + </object> + </array> + </object> + <dictionary class="NSMutableDictionary" key="flattenedProperties"> + <string key="-1.CustomClassName">CreationsTableViewController</string> + <string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="-2.CustomClassName">UIResponder</string> + <string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + </dictionary> + <dictionary class="NSMutableDictionary" key="unlocalizedProperties"/> + <nil key="activeLocalization"/> + <dictionary class="NSMutableDictionary" key="localizations"/> + <nil key="sourceID"/> + <int key="maxID">7</int> + </object> + <object class="IBClassDescriber" key="IBDocument.Classes"> + <array class="NSMutableArray" key="referencedPartialClassDescriptions"> + <object class="IBPartialClassDescription"> + <string key="className">CreationsTableViewController</string> + <string key="superclassName">UITableViewController</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">./Classes/CreationsTableViewController.h</string> + </object> + </object> + </array> + </object> + <int key="IBDocument.localizationMode">0</int> + <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string> + <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> + <int key="IBDocument.defaultPropertyAccessControl">3</int> + <bool key="IBDocument.UseAutolayout">YES</bool> + <string key="IBCocoaTouchPluginVersion">2083</string> + </data> +</archive> diff --git a/cakeside-ios/controllers/LoginViewController.m b/cakeside-ios/controllers/LoginViewController.m index 89aaed1..7c1dcd4 100644 --- a/cakeside-ios/controllers/LoginViewController.m +++ b/cakeside-ios/controllers/LoginViewController.m @@ -1,4 +1,5 @@ #import "LoginViewController.h" +#import "CreationsTableViewController.h" @interface LoginViewController ()<UITextFieldDelegate> @property (strong, nonatomic) MBProgressHUD *HUD; @@ -120,6 +121,10 @@ [SSKeychain setPassword:self.emailTextBox.text forService:KEYCHAIN_USER_NAME account:KEYCHAIN_ACCOUNT]; [SSKeychain setPassword:self.passwordTextBox.text forService:KEYCHAIN_USER_PASSWORD account:KEYCHAIN_ACCOUNT]; //[self performSegueWithIdentifier:@"gotoMainInterface" sender:nil]; + CreationsTableViewController *controller = [[CreationsTableViewController alloc] initWithNibName:@"CreationsTableViewController" bundle:nil]; + [self.navigationController popViewControllerAnimated:NO]; + [self.navigationController pushViewController:controller animated:YES]; + } } failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON) |
