Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit 2a781b956ec0efd047220eccfd44e743a2ff6f81 @vicpenap committed Apr 11, 2012
Showing with 7,109 additions and 0 deletions.
  1. +7 −0 .gitignore
  2. +21 −0 LICENSE.txt
  3. +374 −0 PrettyExample.xcodeproj/project.pbxproj
  4. +7 −0 PrettyExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  5. +17 −0 PrettyExample/AppDelegate.h
  6. +77 −0 PrettyExample/AppDelegate.m
  7. +13 −0 PrettyExample/ExampleViewController.h
  8. +243 −0 PrettyExample/ExampleViewController.m
  9. +179 −0 PrettyExample/ExampleViewController.xib
  10. +319 −0 PrettyExample/MainWindow.xib
  11. +13 −0 PrettyExample/PlainExample.h
  12. +213 −0 PrettyExample/PlainExample.m
  13. +141 −0 PrettyExample/PlainExample.xib
  14. +42 −0 PrettyExample/PrettyExample-Info.plist
  15. +14 −0 PrettyExample/PrettyExample-Prefix.pch
  16. +46 −0 PrettyExample/PrettyKit/Cells/PrettyCustomViewTableViewCell.h
  17. +85 −0 PrettyExample/PrettyKit/Cells/PrettyCustomViewTableViewCell.m
  18. +177 −0 PrettyExample/PrettyKit/Cells/PrettyGridTableViewCell.h
  19. +547 −0 PrettyExample/PrettyKit/Cells/PrettyGridTableViewCell.m
  20. +63 −0 PrettyExample/PrettyKit/Cells/PrettySegmentedControlTableViewCell.h
  21. +106 −0 PrettyExample/PrettyKit/Cells/PrettySegmentedControlTableViewCell.m
  22. +242 −0 PrettyExample/PrettyKit/Cells/PrettyTableViewCell.h
  23. +602 −0 PrettyExample/PrettyKit/Cells/PrettyTableViewCell.m
  24. +95 −0 PrettyExample/PrettyKit/PrettyDrawing.h
  25. +142 −0 PrettyExample/PrettyKit/PrettyDrawing.m
  26. +37 −0 PrettyExample/PrettyKit/PrettyKit.h
  27. +75 −0 PrettyExample/PrettyKit/PrettyNavigationBar.h
  28. +113 −0 PrettyExample/PrettyKit/PrettyNavigationBar.m
  29. +68 −0 PrettyExample/PrettyKit/PrettyShadowPlainTableview.h
  30. +90 −0 PrettyExample/PrettyKit/PrettyShadowPlainTableview.m
  31. +61 −0 PrettyExample/PrettyKit/PrettyTabBar.h
  32. +90 −0 PrettyExample/PrettyKit/PrettyTabBar.m
  33. +13 −0 PrettyExample/RotableTabBarController.h
  34. +18 −0 PrettyExample/RotableTabBarController.m
  35. BIN PrettyExample/background.png
  36. BIN PrettyExample/background@2x.png
  37. +2 −0 PrettyExample/en.lproj/InfoPlist.strings
  38. +18 −0 PrettyExample/main.m
  39. +46 −0 PrettyKit/Cells/PrettyCustomViewTableViewCell.h
  40. +85 −0 PrettyKit/Cells/PrettyCustomViewTableViewCell.m
  41. +177 −0 PrettyKit/Cells/PrettyGridTableViewCell.h
  42. +547 −0 PrettyKit/Cells/PrettyGridTableViewCell.m
  43. +63 −0 PrettyKit/Cells/PrettySegmentedControlTableViewCell.h
  44. +106 −0 PrettyKit/Cells/PrettySegmentedControlTableViewCell.m
  45. +242 −0 PrettyKit/Cells/PrettyTableViewCell.h
  46. +602 −0 PrettyKit/Cells/PrettyTableViewCell.m
  47. +95 −0 PrettyKit/PrettyDrawing.h
  48. +142 −0 PrettyKit/PrettyDrawing.m
  49. +37 −0 PrettyKit/PrettyKit.h
  50. +75 −0 PrettyKit/PrettyNavigationBar.h
  51. +113 −0 PrettyKit/PrettyNavigationBar.m
  52. +68 −0 PrettyKit/PrettyShadowPlainTableview.h
  53. +90 −0 PrettyKit/PrettyShadowPlainTableview.m
  54. +61 −0 PrettyKit/PrettyTabBar.h
  55. +90 −0 PrettyKit/PrettyTabBar.m
  56. +100 −0 README.md
  57. BIN Screenshots/blended_layers.png
  58. BIN Screenshots/blue_navbar.png
  59. BIN Screenshots/cells.png
  60. BIN Screenshots/grid.png
  61. BIN Screenshots/grouped_table.png
  62. BIN Screenshots/plain_cells.png
  63. BIN Screenshots/plain_table.png
  64. BIN Screenshots/segmented_control.png
  65. BIN Screenshots/tabbar.png
@@ -0,0 +1,7 @@
+.DS_Store
+PrettyExample.xcodeproj/xcuserdata/
+PrettyExample.xcodeproj/project.xcworkspace/xcuserdata/
+build/
+PrettyExample.xcodeproj/*.mode1v3
+PrettyExample.xcodeproj/*.pbxuser
+
@@ -0,0 +1,21 @@
+Copyright (c) 2012 Víctor Pena Placer (@vicpenap)
+http://www.victorpena.es/
+
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

Large diffs are not rendered by default.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,17 @@
+//
+// AppDelegate.h
+// PrettyExample
+//
+// Created by Víctor on 28/02/12.
+// Copyright (c) 2012 Victor Pena Placer. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface AppDelegate : UIResponder <UIApplicationDelegate>
+
+@property (strong, nonatomic) UIWindow *window;
+
+@property (nonatomic, retain) IBOutlet UITabBarController *tabBarController;
+
+@end
@@ -0,0 +1,77 @@
+//
+// AppDelegate.m
+// PrettyExample
+//
+// Created by Víctor on 28/02/12.
+// Copyright (c) 2012 Victor Pena Placer. All rights reserved.
+//
+
+#import "AppDelegate.h"
+#import "ExampleViewController.h"
+
+@implementation AppDelegate
+
+@synthesize window = _window;
+@synthesize tabBarController;
+
+- (void)dealloc
+{
+ self.tabBarController = nil;
+ [_window release];
+ [super dealloc];
+}
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
+{
+ [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque];
+ self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
+ // Override point for customization after application launch.
+ self.window.backgroundColor = [UIColor whiteColor];
+
+ self.window.rootViewController = self.tabBarController;
+
+
+ [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
@@ -0,0 +1,13 @@
+//
+// ExampleViewController.h
+// PrettyExample
+//
+// Created by Víctor on 29/02/12.
+// Copyright (c) 2012 Victor Pena Placer. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface ExampleViewController : UITableViewController
+
+@end
@@ -0,0 +1,243 @@
+//
+// ExampleViewController.m
+// PrettyExample
+//
+// Created by Víctor on 29/02/12.
+// Copyright (c) 2012 Victor Pena Placer. All rights reserved.
+//
+
+#import "ExampleViewController.h"
+#import "PrettyKit.h"
+
+
+@implementation ExampleViewController
+
+
+- (void)didReceiveMemoryWarning
+{
+ // Releases the view if it doesn't have a superview.
+ [super didReceiveMemoryWarning];
+
+ // Release any cached data, images, etc that aren't in use.
+}
+
+#pragma mark - View lifecycle
+
+- (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.navigationItem.title = @"PrettyKit";
+ self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose target:nil action:nil] autorelease];
+ self.tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"background"]];
+}
+
+- (void)viewDidUnload
+{
+ [super viewDidUnload];
+ // Release any retained subviews of the main view.
+ // e.g. self.myOutlet = nil;
+}
+
+- (void)viewWillAppear:(BOOL)animated
+{
+ [super viewWillAppear:animated];
+}
+
+- (void)viewDidAppear:(BOOL)animated
+{
+ [super viewDidAppear:animated];
+}
+
+- (void)viewWillDisappear:(BOOL)animated
+{
+ [super viewWillDisappear:animated];
+}
+
+- (void)viewDidDisappear:(BOOL)animated
+{
+ [super viewDidDisappear:animated];
+}
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
+{
+ // Return YES for supported orientations
+ return (interfaceOrientation == UIInterfaceOrientationPortrait);
+}
+
+#pragma mark - Table view data source
+
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
+{
+ // Return the number of sections.
+ return 5;
+}
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
+{
+ // Return the number of rows in the section.
+ if (section == 0) {
+ return 3;
+ }
+ if (section == 1) {
+ return 1;
+ }
+ if (section == 2) {
+ return 1;
+ }
+ if (section == 3) {
+ return 20;
+ }
+ if (section == 4) {
+ return 1;
+ }
+
+ return 0;
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ static NSString *CellIdentifier = @"Cell";
+ static NSString *SegmentedCellIdentifier = @"SegmentedCell";
+ PrettySegmentedControlTableViewCell *segmentedCell;
+ static NSString *GridCellIdentifier = @"GridCell";
+ PrettyGridTableViewCell *gridCell;
+
+
+ PrettyTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
+ if (cell == nil) {
+ cell = [[[PrettyTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
+ cell.tableViewBackgroundColor = tableView.backgroundColor;
+ }
+
+ switch (indexPath.section) {
+ case 1:
+ switch (indexPath.row) {
+ case 0:
+ segmentedCell = [tableView dequeueReusableCellWithIdentifier:SegmentedCellIdentifier];
+ if (segmentedCell == nil) {
+ segmentedCell = [[[PrettySegmentedControlTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SegmentedCellIdentifier] autorelease];
+ }
+ [segmentedCell prepareForTableView:tableView indexPath:indexPath];
+ segmentedCell.titles = [NSArray arrayWithObjects:@"1", @"2", @"3", @"4", nil];
+ segmentedCell.tableViewBackgroundColor = tableView.backgroundColor;
+ return segmentedCell;
+ default:
+ break;
+ }
+
+ break;
+ case 2:
+ gridCell = [tableView dequeueReusableCellWithIdentifier:GridCellIdentifier];
+ if (gridCell == nil) {
+ gridCell = [[[PrettyGridTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:GridCellIdentifier] autorelease];
+ gridCell.tableViewBackgroundColor = tableView.backgroundColor;
+ gridCell.actionBlock = ^(NSIndexPath *indexPath, int selectedIndex) {
+ [gridCell deselectAnimated:YES];
+ };
+ }
+ [gridCell prepareForTableView:tableView indexPath:indexPath];
+ gridCell.numberOfElements = 3;
+ [gridCell setText:@"One" atIndex:0];
+ [gridCell setDetailText:@"Detail Text" atIndex:0];
+ [gridCell setText:@"Two" atIndex:1];
+ [gridCell setDetailText:@"Detail Text" atIndex:1];
+ [gridCell setText:@"Three" atIndex:2];
+ [gridCell setDetailText:@"Detail Text" atIndex:2];
+ return gridCell;
+ case 4:
+ gridCell = [tableView dequeueReusableCellWithIdentifier:GridCellIdentifier];
+ if (gridCell == nil) {
+ gridCell = [[[PrettyGridTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:GridCellIdentifier] autorelease];
+ gridCell.tableViewBackgroundColor = tableView.backgroundColor;
+ gridCell.actionBlock = ^(NSIndexPath *indexPath, int selectedIndex) {
+ [gridCell deselectAnimated:YES];
+ };
+ }
+ [gridCell prepareForTableView:tableView indexPath:indexPath];
+ gridCell.numberOfElements = 2;
+ [gridCell setText:@"Four" atIndex:0];
+ [gridCell setText:@"Five" atIndex:1];
+ return gridCell;
+
+ default:
+ break;
+ }
+
+ // Configure the cell...
+ [cell prepareForTableView:tableView indexPath:indexPath];
+ cell.textLabel.text = @"Text";
+ if (indexPath.section == 0) {
+ cell.cornerRadius = 20;
+ }
+ else {
+ cell.cornerRadius = 10;
+ }
+
+ 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:[NSArray arrayWithObject: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
+
+-(CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
+ return tableView.rowHeight + [PrettyTableViewCell tableView:tableView neededHeightForIndexPath:indexPath];
+}
+
+- (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];
+ [detailViewController release];
+ */
+ [tableView deselectRowAtIndexPath:indexPath animated:YES];
+}
+
+@end
Oops, something went wrong.

0 comments on commit 2a781b9

Please sign in to comment.