From 7e7b734fc859234c9424b2ed98f5a2afef911de0 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 26 Oct 2013 13:10:31 +0400 Subject: Initial Commit --- Juick/AppDelegate.h | 15 +++ Juick/AppDelegate.m | 46 +++++++++ Juick/Base.lproj/Main.storyboard | 104 +++++++++++++++++++ Juick/DetailViewController.h | 16 +++ Juick/DetailViewController.m | 51 ++++++++++ .../AppIcon.appiconset/Contents.json | 23 +++++ .../LaunchImage.launchimage/Contents.json | 23 +++++ Juick/Juick-Info.plist | 50 +++++++++ Juick/Juick-Prefix.pch | 16 +++ Juick/MasterViewController.h | 13 +++ Juick/MasterViewController.m | 113 +++++++++++++++++++++ Juick/en.lproj/InfoPlist.strings | 2 + Juick/main.m | 18 ++++ 13 files changed, 490 insertions(+) create mode 100644 Juick/AppDelegate.h create mode 100644 Juick/AppDelegate.m create mode 100644 Juick/Base.lproj/Main.storyboard create mode 100644 Juick/DetailViewController.h create mode 100644 Juick/DetailViewController.m create mode 100644 Juick/Images.xcassets/AppIcon.appiconset/Contents.json create mode 100644 Juick/Images.xcassets/LaunchImage.launchimage/Contents.json create mode 100644 Juick/Juick-Info.plist create mode 100644 Juick/Juick-Prefix.pch create mode 100644 Juick/MasterViewController.h create mode 100644 Juick/MasterViewController.m create mode 100644 Juick/en.lproj/InfoPlist.strings create mode 100644 Juick/main.m (limited to 'Juick') diff --git a/Juick/AppDelegate.h b/Juick/AppDelegate.h new file mode 100644 index 0000000..ae4c86a --- /dev/null +++ b/Juick/AppDelegate.h @@ -0,0 +1,15 @@ +// +// AppDelegate.h +// Juick +// +// Created by Vitaly Takmazov on 26.10.13. +// Copyright (c) 2013 com.juick. All rights reserved. +// + +#import + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + +@end diff --git a/Juick/AppDelegate.m b/Juick/AppDelegate.m new file mode 100644 index 0000000..40b5fae --- /dev/null +++ b/Juick/AppDelegate.m @@ -0,0 +1,46 @@ +// +// AppDelegate.m +// Juick +// +// Created by Vitaly Takmazov on 26.10.13. +// Copyright (c) 2013 com.juick. All rights reserved. +// + +#import "AppDelegate.h" + +@implementation AppDelegate + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions +{ + // Override point for customization after application launch. + 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/Juick/Base.lproj/Main.storyboard b/Juick/Base.lproj/Main.storyboard new file mode 100644 index 0000000..3d5f90c --- /dev/null +++ b/Juick/Base.lproj/Main.storyboard @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Juick/DetailViewController.h b/Juick/DetailViewController.h new file mode 100644 index 0000000..1246805 --- /dev/null +++ b/Juick/DetailViewController.h @@ -0,0 +1,16 @@ +// +// DetailViewController.h +// Juick +// +// Created by Vitaly Takmazov on 26.10.13. +// Copyright (c) 2013 com.juick. All rights reserved. +// + +#import + +@interface DetailViewController : UIViewController + +@property (strong, nonatomic) id detailItem; + +@property (weak, nonatomic) IBOutlet UILabel *detailDescriptionLabel; +@end diff --git a/Juick/DetailViewController.m b/Juick/DetailViewController.m new file mode 100644 index 0000000..4d510c9 --- /dev/null +++ b/Juick/DetailViewController.m @@ -0,0 +1,51 @@ +// +// DetailViewController.m +// Juick +// +// Created by Vitaly Takmazov on 26.10.13. +// Copyright (c) 2013 com.juick. All rights reserved. +// + +#import "DetailViewController.h" + +@interface DetailViewController () +- (void)configureView; +@end + +@implementation DetailViewController + +#pragma mark - Managing the detail item + +- (void)setDetailItem:(id)newDetailItem +{ + if (_detailItem != newDetailItem) { + _detailItem = newDetailItem; + + // Update the view. + [self configureView]; + } +} + +- (void)configureView +{ + // Update the user interface for the detail item. + + if (self.detailItem) { + self.detailDescriptionLabel.text = [self.detailItem description]; + } +} + +- (void)viewDidLoad +{ + [super viewDidLoad]; + // Do any additional setup after loading the view, typically from a nib. + [self configureView]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +@end diff --git a/Juick/Images.xcassets/AppIcon.appiconset/Contents.json b/Juick/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..a396706 --- /dev/null +++ b/Juick/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Juick/Images.xcassets/LaunchImage.launchimage/Contents.json b/Juick/Images.xcassets/LaunchImage.launchimage/Contents.json new file mode 100644 index 0000000..c79ebd3 --- /dev/null +++ b/Juick/Images.xcassets/LaunchImage.launchimage/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "orientation" : "portrait", + "idiom" : "iphone", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "subtype" : "retina4", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Juick/Juick-Info.plist b/Juick/Juick-Info.plist new file mode 100644 index 0000000..846633e --- /dev/null +++ b/Juick/Juick-Info.plist @@ -0,0 +1,50 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.juick.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UIStatusBarTintParameters + + UINavigationBar + + Style + UIBarStyleDefault + Translucent + + + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/Juick/Juick-Prefix.pch b/Juick/Juick-Prefix.pch new file mode 100644 index 0000000..82a2bb4 --- /dev/null +++ b/Juick/Juick-Prefix.pch @@ -0,0 +1,16 @@ +// +// Prefix header +// +// The contents of this file are implicitly included at the beginning of every source file. +// + +#import + +#ifndef __IPHONE_5_0 +#warning "This project uses features only available in iOS SDK 5.0 and later." +#endif + +#ifdef __OBJC__ + #import + #import +#endif diff --git a/Juick/MasterViewController.h b/Juick/MasterViewController.h new file mode 100644 index 0000000..be49967 --- /dev/null +++ b/Juick/MasterViewController.h @@ -0,0 +1,13 @@ +// +// MasterViewController.h +// Juick +// +// Created by Vitaly Takmazov on 26.10.13. +// Copyright (c) 2013 com.juick. All rights reserved. +// + +#import + +@interface MasterViewController : UITableViewController + +@end diff --git a/Juick/MasterViewController.m b/Juick/MasterViewController.m new file mode 100644 index 0000000..41b2ef5 --- /dev/null +++ b/Juick/MasterViewController.m @@ -0,0 +1,113 @@ +// +// MasterViewController.m +// Juick +// +// Created by Vitaly Takmazov on 26.10.13. +// Copyright (c) 2013 com.juick. All rights reserved. +// + +#import "MasterViewController.h" + +#import "DetailViewController.h" + +@interface MasterViewController () { + NSMutableArray *_objects; +} +@end + +@implementation MasterViewController + +- (void)awakeFromNib +{ + [super awakeFromNib]; +} + +- (void)viewDidLoad +{ + [super viewDidLoad]; + // Do any additional setup after loading the view, typically from a nib. + self.navigationItem.leftBarButtonItem = self.editButtonItem; + + UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(insertNewObject:)]; + self.navigationItem.rightBarButtonItem = addButton; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)insertNewObject:(id)sender +{ + if (!_objects) { + _objects = [[NSMutableArray alloc] init]; + } + [_objects insertObject:[NSDate date] atIndex:0]; + NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; + [self.tableView insertRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic]; +} + +#pragma mark - Table View + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return _objects.count; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath]; + + NSDate *object = _objects[indexPath.row]; + cell.textLabel.text = [object description]; + return cell; +} + +- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath +{ + // Return NO if you do not want the specified item to be editable. + return YES; +} + +- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath +{ + if (editingStyle == UITableViewCellEditingStyleDelete) { + [_objects removeObjectAtIndex:indexPath.row]; + [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; +} +*/ + +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender +{ + if ([[segue identifier] isEqualToString:@"showDetail"]) { + NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; + NSDate *object = _objects[indexPath.row]; + [[segue destinationViewController] setDetailItem:object]; + } +} + +@end diff --git a/Juick/en.lproj/InfoPlist.strings b/Juick/en.lproj/InfoPlist.strings new file mode 100644 index 0000000..477b28f --- /dev/null +++ b/Juick/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/Juick/main.m b/Juick/main.m new file mode 100644 index 0000000..67b222f --- /dev/null +++ b/Juick/main.m @@ -0,0 +1,18 @@ +// +// main.m +// Juick +// +// Created by Vitaly Takmazov on 26.10.13. +// Copyright (c) 2013 com.juick. All rights reserved. +// + +#import + +#import "AppDelegate.h" + +int main(int argc, char * argv[]) +{ + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} -- cgit v1.2.3