diff --git a/Workspaces/Projects/SFTableViewCellTutorial/SFTableViewCellTutorial.xcodeproj/project.pbxproj b/Workspaces/Projects/SFTableViewCellTutorial/SFTableViewCellTutorial.xcodeproj/project.pbxproj new file mode 100644 index 0000000..1cbbb8b --- /dev/null +++ b/Workspaces/Projects/SFTableViewCellTutorial/SFTableViewCellTutorial.xcodeproj/project.pbxproj @@ -0,0 +1,275 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + B36B299415D4C912006719DC /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B36B299315D4C912006719DC /* UIKit.framework */; }; + B36B299615D4C912006719DC /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B36B299515D4C912006719DC /* Foundation.framework */; }; + B36B299815D4C912006719DC /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B36B299715D4C912006719DC /* CoreGraphics.framework */; }; + B36B299E15D4C912006719DC /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = B36B299C15D4C912006719DC /* InfoPlist.strings */; }; + B36B29A015D4C912006719DC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B36B299F15D4C912006719DC /* main.m */; }; + B36B29A415D4C912006719DC /* SFAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B36B29A315D4C912006719DC /* SFAppDelegate.m */; }; + B36B29AC15D4C985006719DC /* SFTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B36B29AB15D4C985006719DC /* SFTableViewController.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + B36B298F15D4C912006719DC /* SFTableViewCellTutorial.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SFTableViewCellTutorial.app; sourceTree = BUILT_PRODUCTS_DIR; }; + B36B299315D4C912006719DC /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + B36B299515D4C912006719DC /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + B36B299715D4C912006719DC /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + B36B299B15D4C912006719DC /* SFTableViewCellTutorial-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SFTableViewCellTutorial-Info.plist"; sourceTree = ""; }; + B36B299D15D4C912006719DC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + B36B299F15D4C912006719DC /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + B36B29A115D4C912006719DC /* SFTableViewCellTutorial-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SFTableViewCellTutorial-Prefix.pch"; sourceTree = ""; }; + B36B29A215D4C912006719DC /* SFAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SFAppDelegate.h; sourceTree = ""; }; + B36B29A315D4C912006719DC /* SFAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SFAppDelegate.m; sourceTree = ""; }; + B36B29AA15D4C985006719DC /* SFTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SFTableViewController.h; path = "../../../Sources/t4-uitableviewcell/SFTableViewController.h"; sourceTree = ""; }; + B36B29AB15D4C985006719DC /* SFTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SFTableViewController.m; path = "../../../Sources/t4-uitableviewcell/SFTableViewController.m"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + B36B298C15D4C912006719DC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + B36B299415D4C912006719DC /* UIKit.framework in Frameworks */, + B36B299615D4C912006719DC /* Foundation.framework in Frameworks */, + B36B299815D4C912006719DC /* CoreGraphics.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + B36B298415D4C912006719DC = { + isa = PBXGroup; + children = ( + B36B299915D4C912006719DC /* SFTableViewCellTutorial */, + B36B299215D4C912006719DC /* Frameworks */, + B36B299015D4C912006719DC /* Products */, + ); + sourceTree = ""; + }; + B36B299015D4C912006719DC /* Products */ = { + isa = PBXGroup; + children = ( + B36B298F15D4C912006719DC /* SFTableViewCellTutorial.app */, + ); + name = Products; + sourceTree = ""; + }; + B36B299215D4C912006719DC /* Frameworks */ = { + isa = PBXGroup; + children = ( + B36B299315D4C912006719DC /* UIKit.framework */, + B36B299515D4C912006719DC /* Foundation.framework */, + B36B299715D4C912006719DC /* CoreGraphics.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + B36B299915D4C912006719DC /* SFTableViewCellTutorial */ = { + isa = PBXGroup; + children = ( + B36B29AA15D4C985006719DC /* SFTableViewController.h */, + B36B29AB15D4C985006719DC /* SFTableViewController.m */, + B36B29A215D4C912006719DC /* SFAppDelegate.h */, + B36B29A315D4C912006719DC /* SFAppDelegate.m */, + B36B299A15D4C912006719DC /* Supporting Files */, + ); + path = SFTableViewCellTutorial; + sourceTree = ""; + }; + B36B299A15D4C912006719DC /* Supporting Files */ = { + isa = PBXGroup; + children = ( + B36B299B15D4C912006719DC /* SFTableViewCellTutorial-Info.plist */, + B36B299C15D4C912006719DC /* InfoPlist.strings */, + B36B299F15D4C912006719DC /* main.m */, + B36B29A115D4C912006719DC /* SFTableViewCellTutorial-Prefix.pch */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + B36B298E15D4C912006719DC /* SFTableViewCellTutorial */ = { + isa = PBXNativeTarget; + buildConfigurationList = B36B29A715D4C912006719DC /* Build configuration list for PBXNativeTarget "SFTableViewCellTutorial" */; + buildPhases = ( + B36B298B15D4C912006719DC /* Sources */, + B36B298C15D4C912006719DC /* Frameworks */, + B36B298D15D4C912006719DC /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SFTableViewCellTutorial; + productName = SFTableViewCellTutorial; + productReference = B36B298F15D4C912006719DC /* SFTableViewCellTutorial.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + B36B298615D4C912006719DC /* Project object */ = { + isa = PBXProject; + attributes = { + CLASSPREFIX = SF; + LastUpgradeCheck = 0440; + ORGANIZATIONNAME = saltfactory.net; + }; + buildConfigurationList = B36B298915D4C912006719DC /* Build configuration list for PBXProject "SFTableViewCellTutorial" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = B36B298415D4C912006719DC; + productRefGroup = B36B299015D4C912006719DC /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + B36B298E15D4C912006719DC /* SFTableViewCellTutorial */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + B36B298D15D4C912006719DC /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B36B299E15D4C912006719DC /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + B36B298B15D4C912006719DC /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B36B29A015D4C912006719DC /* main.m in Sources */, + B36B29A415D4C912006719DC /* SFAppDelegate.m in Sources */, + B36B29AC15D4C985006719DC /* SFTableViewController.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + B36B299C15D4C912006719DC /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + B36B299D15D4C912006719DC /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + B36B29A515D4C912006719DC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 5.1; + SDKROOT = iphoneos; + }; + name = Debug; + }; + B36B29A615D4C912006719DC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 5.1; + OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + B36B29A815D4C912006719DC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "SFTableViewCellTutorial/SFTableViewCellTutorial-Prefix.pch"; + INFOPLIST_FILE = "SFTableViewCellTutorial/SFTableViewCellTutorial-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + B36B29A915D4C912006719DC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "SFTableViewCellTutorial/SFTableViewCellTutorial-Prefix.pch"; + INFOPLIST_FILE = "SFTableViewCellTutorial/SFTableViewCellTutorial-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + B36B298915D4C912006719DC /* Build configuration list for PBXProject "SFTableViewCellTutorial" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B36B29A515D4C912006719DC /* Debug */, + B36B29A615D4C912006719DC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + B36B29A715D4C912006719DC /* Build configuration list for PBXNativeTarget "SFTableViewCellTutorial" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B36B29A815D4C912006719DC /* Debug */, + B36B29A915D4C912006719DC /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; +/* End XCConfigurationList section */ + }; + rootObject = B36B298615D4C912006719DC /* Project object */; +} diff --git a/Workspaces/Projects/SFTableViewCellTutorial/SFTableViewCellTutorial/SFAppDelegate.h b/Workspaces/Projects/SFTableViewCellTutorial/SFTableViewCellTutorial/SFAppDelegate.h new file mode 100644 index 0000000..2f02a0d --- /dev/null +++ b/Workspaces/Projects/SFTableViewCellTutorial/SFTableViewCellTutorial/SFAppDelegate.h @@ -0,0 +1,15 @@ +// +// SFAppDelegate.h +// SFTableViewCellTutorial +// +// Created by saltfactory on 8/10/12. +// Copyright (c) 2012 saltfactory.net. All rights reserved. +// + +#import + +@interface SFAppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + +@end diff --git a/Workspaces/Projects/SFTableViewCellTutorial/SFTableViewCellTutorial/SFAppDelegate.m b/Workspaces/Projects/SFTableViewCellTutorial/SFTableViewCellTutorial/SFAppDelegate.m new file mode 100644 index 0000000..7fb5818 --- /dev/null +++ b/Workspaces/Projects/SFTableViewCellTutorial/SFTableViewCellTutorial/SFAppDelegate.m @@ -0,0 +1,54 @@ +// +// SFAppDelegate.m +// SFTableViewCellTutorial +// +// Created by saltfactory on 8/10/12. +// Copyright (c) 2012 saltfactory.net. All rights reserved. +// + +#import "SFAppDelegate.h" +#import "SFTableViewController.h" + +@implementation SFAppDelegate + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions +{ + self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; + // Override point for customization after application launch. + self.window.backgroundColor = [UIColor whiteColor]; + + SFTableViewController *tableViewController = [[SFTableViewController alloc] init]; + UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:tableViewController]; + self.window.rootViewController = navigationController; + [self.window makeKeyAndVisible]; + return YES; +} + +- (void)applicationWillResignActive:(UIApplication *)application +{ + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. +} + +- (void)applicationDidEnterBackground:(UIApplication *)application +{ + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. +} + +- (void)applicationWillEnterForeground:(UIApplication *)application +{ + // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. +} + +- (void)applicationDidBecomeActive:(UIApplication *)application +{ + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. +} + +- (void)applicationWillTerminate:(UIApplication *)application +{ + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. +} + +@end diff --git a/Workspaces/Projects/SFTableViewCellTutorial/SFTableViewCellTutorial/SFTableViewCellTutorial-Info.plist b/Workspaces/Projects/SFTableViewCellTutorial/SFTableViewCellTutorial/SFTableViewCellTutorial-Info.plist new file mode 100644 index 0000000..31883c4 --- /dev/null +++ b/Workspaces/Projects/SFTableViewCellTutorial/SFTableViewCellTutorial/SFTableViewCellTutorial-Info.plist @@ -0,0 +1,38 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + net.saltfactory.tutorial.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/Workspaces/Projects/SFTableViewCellTutorial/SFTableViewCellTutorial/SFTableViewCellTutorial-Prefix.pch b/Workspaces/Projects/SFTableViewCellTutorial/SFTableViewCellTutorial/SFTableViewCellTutorial-Prefix.pch new file mode 100644 index 0000000..e57c6b3 --- /dev/null +++ b/Workspaces/Projects/SFTableViewCellTutorial/SFTableViewCellTutorial/SFTableViewCellTutorial-Prefix.pch @@ -0,0 +1,14 @@ +// +// Prefix header for all source files of the 'SFTableViewCellTutorial' target in the 'SFTableViewCellTutorial' project +// + +#import + +#ifndef __IPHONE_3_0 +#warning "This project uses features only available in iOS SDK 3.0 and later." +#endif + +#ifdef __OBJC__ + #import + #import +#endif diff --git a/Workspaces/Projects/SFTableViewCellTutorial/SFTableViewCellTutorial/en.lproj/InfoPlist.strings b/Workspaces/Projects/SFTableViewCellTutorial/SFTableViewCellTutorial/en.lproj/InfoPlist.strings new file mode 100644 index 0000000..477b28f --- /dev/null +++ b/Workspaces/Projects/SFTableViewCellTutorial/SFTableViewCellTutorial/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/Workspaces/Projects/SFTableViewCellTutorial/SFTableViewCellTutorial/main.m b/Workspaces/Projects/SFTableViewCellTutorial/SFTableViewCellTutorial/main.m new file mode 100644 index 0000000..437d236 --- /dev/null +++ b/Workspaces/Projects/SFTableViewCellTutorial/SFTableViewCellTutorial/main.m @@ -0,0 +1,18 @@ +// +// main.m +// SFTableViewCellTutorial +// +// Created by saltfactory on 8/10/12. +// Copyright (c) 2012 saltfactory.net. All rights reserved. +// + +#import + +#import "SFAppDelegate.h" + +int main(int argc, char *argv[]) +{ + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([SFAppDelegate class])); + } +} diff --git a/Workspaces/Saltfactory_iOS_Tutorial.xcworkspace/contents.xcworkspacedata b/Workspaces/Saltfactory_iOS_Tutorial.xcworkspace/contents.xcworkspacedata index 94b2795..a3d9904 100644 --- a/Workspaces/Saltfactory_iOS_Tutorial.xcworkspace/contents.xcworkspacedata +++ b/Workspaces/Saltfactory_iOS_Tutorial.xcworkspace/contents.xcworkspacedata @@ -1,4 +1,7 @@ + + diff --git a/Workspaces/Sources/t4-uitableviewcell/SFTableViewController.h b/Workspaces/Sources/t4-uitableviewcell/SFTableViewController.h new file mode 100644 index 0000000..66efd21 --- /dev/null +++ b/Workspaces/Sources/t4-uitableviewcell/SFTableViewController.h @@ -0,0 +1,13 @@ +// +// SFTableViewController.h +// SFTableViewCellTutorial +// +// Created by saltfactory on 8/10/12. +// Copyright (c) 2012 saltfactory.net. All rights reserved. +// + +#import + +@interface SFTableViewController : UITableViewController + +@end diff --git a/Workspaces/Sources/t4-uitableviewcell/SFTableViewController.m b/Workspaces/Sources/t4-uitableviewcell/SFTableViewController.m new file mode 100644 index 0000000..bab8bd8 --- /dev/null +++ b/Workspaces/Sources/t4-uitableviewcell/SFTableViewController.m @@ -0,0 +1,177 @@ +// +// SFTableViewController.m +// SFTableViewCellTutorial +// +// Created by saltfactory on 8/10/12. +// Copyright (c) 2012 saltfactory.net. All rights reserved. +// + +#import "SFTableViewController.h" + +@interface Item : NSObject +@property (nonatomic, strong) NSString *title; +@property (nonatomic, strong) NSString *description; +- (id)initWithTitle:(NSString *)aTitle description:(NSString *)aDescription; +@end + +@implementation Item +@synthesize title, description; +- (id)initWithTitle:(NSString *)aTitle description:(NSString *)aDescription +{ + self = [super init]; + if (self) { + self.title = aTitle; + self.description = aDescription; + } + + return self; +} + +@end + + +@interface SFTableViewController () +{ + NSArray *items; +} +@end + +@implementation SFTableViewController + +- (id)initWithStyle:(UITableViewStyle)style +{ + self = [super initWithStyle:style]; + if (self) { + // Custom initialization + } + return self; +} + +- (id)init +{ + self = [super initWithStyle:UITableViewStylePlain]; + + if (self) { + items = [NSArray arrayWithObjects: + [[Item alloc] initWithTitle:@"items1" description:@"detail description1"], + [[Item alloc] initWithTitle:@"items2" description:@"detail description2"], + [[Item alloc] initWithTitle:@"items3" description:@"detail description3"], + nil]; + } + + 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; + self.title = @"UITableViewCellStyle Test"; +} + +- (void)viewDidUnload +{ + [super viewDidUnload]; + // Release any retained subviews of the main view. + // e.g. self.myOutlet = nil; +} + +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation +{ + return (interfaceOrientation == UIInterfaceOrientationPortrait); +} + +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + // Return the number of sections. + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + // Return the number of rows in the section. + return [items count]; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + static NSString *CellIdentifier = @"Cell"; + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; + + // Configure the cell... + if (cell == nil) { + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier]; + } + + + cell.textLabel.text = [[items objectAtIndex:indexPath.row] valueForKey:@"title"]; + cell.detailTextLabel.text = [[items objectAtIndex:indexPath.row] valueForKey:@"description"]; + + if (indexPath.row % 2 == 1) { + cell.detailTextLabel.textColor = [UIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:1.0]; + } else { + cell.detailTextLabel.textColor = [UIColor colorWithRed:0.22 green:0.33 blue:0.53 alpha:1.0]; + } + 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