From aee22409f219c6477333e1b1962444a1fbf974f0 Mon Sep 17 00:00:00 2001 From: "Gun.io Whitespace Robot" Date: Sat, 29 Oct 2011 12:55:42 -0400 Subject: [PATCH] Remove whitespace [Gun.io WhitespaceBot] --- .gitignore | 20 +++ CustomBackButton/Classes/BaseViewController.h | 8 +- CustomBackButton/Classes/BaseViewController.m | 6 +- .../Classes/CustomBackButtonAppDelegate.h | 8 +- .../Classes/CustomBackButtonAppDelegate.m | 8 +- .../Classes/CustomNavigationBar.h | 6 +- .../Classes/CustomNavigationBar.m | 16 +- .../Classes/DailyBoothViewController.h | 6 +- .../Classes/DailyBoothViewController.m | 6 +- .../Classes/InstagramViewController.h | 6 +- .../Classes/InstagramViewController.m | 6 +- .../Classes/ReederViewController.h | 6 +- .../Classes/ReederViewController.m | 8 +- CustomBackButton/Classes/RootViewController.h | 6 +- CustomBackButton/Classes/RootViewController.m | 12 +- CustomBackButton/main.m | 8 +- .../Classes/CustomSegmentedControl.h | 6 +- .../Classes/CustomSegmentedControl.m | 14 +- .../CustomSegmentedControlsAppDelegate.h | 6 +- .../CustomSegmentedControlsAppDelegate.m | 12 +- .../CustomSegmentedControlsViewController.h | 6 +- .../CustomSegmentedControlsViewController.m | 18 +-- CustomSegmentedControls/main.m | 8 +- CustomTabBar/Classes/CustomTabBar.h | 6 +- CustomTabBar/Classes/CustomTabBar.m | 56 +++---- .../Classes/CustomTabBarAppDelegate.h | 6 +- .../Classes/CustomTabBarAppDelegate.m | 12 +- .../Classes/CustomTabBarViewController.h | 6 +- .../Classes/CustomTabBarViewController.m | 36 ++--- CustomTabBar/main.m | 8 +- .../Classes/BaseViewController.m | 2 +- .../Classes/CustomNavigationBar.m | 10 +- .../CustomTabBarNotificationAppDelegate.h | 2 +- .../CustomTabBarNotificationAppDelegate.m | 8 +- .../Classes/InstagramViewController.h | 2 +- .../Classes/InstagramViewController.m | 16 +- CustomTabBarNotification/main.m | 2 +- .../Classes/BaseViewController.h | 6 +- .../Classes/BaseViewController.m | 8 +- .../Classes/DailyBoothViewController.h | 6 +- .../Classes/DailyBoothViewController.m | 6 +- .../Classes/InstagramViewController.h | 6 +- .../Classes/InstagramViewController.m | 6 +- .../Classes/PathViewController.h | 6 +- .../Classes/PathViewController.m | 6 +- .../Classes/RaisedCenterTabBarAppDelegate.h | 6 +- .../Classes/RaisedCenterTabBarAppDelegate.m | 8 +- .../Classes/RootViewController.h | 6 +- .../Classes/RootViewController.m | 12 +- RaisedCenterTabBar/main.m | 8 +- .../Classes/RootViewController.m | 16 +- .../Classes/SideSwipeTableViewAppDelegate.h | 2 +- .../Classes/SideSwipeTableViewAppDelegate.m | 8 +- .../Classes/SideSwipeTableViewCell.m | 4 +- .../Classes/SideSwipeTableViewController.m | 18 +-- SideSwipeTableView/main.m | 2 +- .../Classes/StretchableImagesAppDelegate.h | 6 +- .../Classes/StretchableImagesAppDelegate.m | 10 +- .../Classes/StretchableImagesViewController.h | 6 +- .../Classes/StretchableImagesViewController.m | 12 +- StretchableImages/main.m | 8 +- TabBarAnimation/Classes/FirstViewController.h | 6 +- TabBarAnimation/Classes/FirstViewController.m | 8 +- .../Classes/TabBarAnimationAppDelegate.h | 6 +- .../Classes/TabBarAnimationAppDelegate.m | 20 +-- TabBarAnimation/main.m | 6 +- .../Classes/RootViewController.h | 6 +- .../Classes/RootViewController.m | 8 +- .../TransparentUIWebViewsAppDelegate.h | 8 +- .../TransparentUIWebViewsAppDelegate.m | 14 +- .../Classes/TransparentWebViewController.h | 6 +- .../Classes/TransparentWebViewController.m | 6 +- .../Classes/WebViewController.h | 6 +- .../Classes/WebViewController.m | 10 +- TransparentUIWebViews/main.m | 6 +- .../Classes/DetailViewController.h | 8 +- .../Classes/DetailViewController.m | 16 +- .../Classes/RootViewController.h | 6 +- .../Classes/RootViewController.m | 6 +- .../VerticalSwipeArticlesAppDelegate.h | 6 +- .../VerticalSwipeArticlesAppDelegate.m | 10 +- .../Classes/VerticalSwipeScrollView.h | 10 +- .../Classes/VerticalSwipeScrollView.m | 42 ++--- VerticalSwipeArticles/JSON/JSON.h | 20 +-- VerticalSwipeArticles/JSON/NSObject+SBJSON.h | 12 +- VerticalSwipeArticles/JSON/NSObject+SBJSON.m | 12 +- VerticalSwipeArticles/JSON/NSString+SBJSON.h | 14 +- VerticalSwipeArticles/JSON/NSString+SBJSON.m | 10 +- VerticalSwipeArticles/JSON/SBJsonBase.h | 14 +- VerticalSwipeArticles/JSON/SBJsonBase.m | 14 +- VerticalSwipeArticles/JSON/SBJsonParser.h | 32 ++-- VerticalSwipeArticles/JSON/SBJsonParser.m | 150 +++++++++--------- VerticalSwipeArticles/JSON/SBJsonWriter.h | 42 ++--- VerticalSwipeArticles/JSON/SBJsonWriter.m | 64 ++++---- VerticalSwipeArticles/main.m | 8 +- .../Classes/CustomSegmentedControl.h | 6 +- .../Classes/CustomSegmentedControl.m | 14 +- WoodUINavigation/Classes/RootViewController.h | 6 +- WoodUINavigation/Classes/RootViewController.m | 14 +- .../Classes/WoodUINavigationAppDelegate.h | 8 +- .../Classes/WoodUINavigationAppDelegate.m | 12 +- WoodUINavigation/main.m | 8 +- .../Classes/BaseLoadingViewController.m | 2 +- .../Classes/BaseTableViewController.m | 10 +- WordPressReimagined/Classes/CustomTabBar.m | 46 +++--- .../Classes/CustomTabBarViewController.m | 34 ++-- .../Classes/FreshlyPressedViewController.m | 12 +- WordPressReimagined/Classes/ModelObject.m | 26 +-- .../Classes/WebViewController.m | 12 +- .../Classes/WordPressReimaginedAppDelegate.m | 2 +- .../Libraries/JSONKit/JSONKit.h | 16 +- .../Libraries/JSONKit/JSONKit.m | 78 ++++----- 112 files changed, 749 insertions(+), 729 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ac8f968 --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +# Compiled source # +################### +*.com +*.class +*.dll +*.exe +*.o +*.so +*.pyc + +# Logs and databases # +###################### +*.log + +# OS generated files # +###################### +.DS_Store* +ehthumbs.db +Icon? +Thumbs.db diff --git a/CustomBackButton/Classes/BaseViewController.h b/CustomBackButton/Classes/BaseViewController.h index c3958f0..ee846d7 100644 --- a/CustomBackButton/Classes/BaseViewController.h +++ b/CustomBackButton/Classes/BaseViewController.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 1/11/11. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -28,7 +28,7 @@ { IBOutlet UIButton* button; IBOutlet UITextField* textField; - + } @property (nonatomic, retain) IBOutlet UIButton* button; diff --git a/CustomBackButton/Classes/BaseViewController.m b/CustomBackButton/Classes/BaseViewController.m index ef8c918..5a416ff 100644 --- a/CustomBackButton/Classes/BaseViewController.m +++ b/CustomBackButton/Classes/BaseViewController.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 1/11/11. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/CustomBackButton/Classes/CustomBackButtonAppDelegate.h b/CustomBackButton/Classes/CustomBackButtonAppDelegate.h index 567c583..5fa9f4c 100644 --- a/CustomBackButton/Classes/CustomBackButtonAppDelegate.h +++ b/CustomBackButton/Classes/CustomBackButtonAppDelegate.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 1/11/11. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -25,7 +25,7 @@ // THE SOFTWARE @interface CustomBackButtonAppDelegate : NSObject { - + UIWindow *window; UINavigationController *navigationController; } diff --git a/CustomBackButton/Classes/CustomBackButtonAppDelegate.m b/CustomBackButton/Classes/CustomBackButtonAppDelegate.m index 3e6be2f..e7407ce 100644 --- a/CustomBackButton/Classes/CustomBackButtonAppDelegate.m +++ b/CustomBackButton/Classes/CustomBackButtonAppDelegate.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 1/11/11. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -62,7 +62,7 @@ - (void)applicationWillResignActive:(UIApplication *)application { - (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. + 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, called instead of applicationWillTerminate: when the user quits. */ } diff --git a/CustomBackButton/Classes/CustomNavigationBar.h b/CustomBackButton/Classes/CustomNavigationBar.h index 31c5cf2..ab02be0 100644 --- a/CustomBackButton/Classes/CustomNavigationBar.h +++ b/CustomBackButton/Classes/CustomNavigationBar.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 1/11/11. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/CustomBackButton/Classes/CustomNavigationBar.m b/CustomBackButton/Classes/CustomNavigationBar.m index c5bdfac..3362f4b 100644 --- a/CustomBackButton/Classes/CustomNavigationBar.m +++ b/CustomBackButton/Classes/CustomNavigationBar.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 1/11/11. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -73,25 +73,25 @@ -(UIButton*) backButtonWith:(UIImage*)backButtonImage highlight:(UIImage*)backBu // Create a custom button UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom]; - + // Set the title to use the same font and shadow as the standard back button button.titleLabel.font = [UIFont boldSystemFontOfSize:[UIFont smallSystemFontSize]]; button.titleLabel.textColor = [UIColor whiteColor]; button.titleLabel.shadowOffset = CGSizeMake(0,-1); button.titleLabel.shadowColor = [UIColor darkGrayColor]; - + // Set the break mode to truncate at the end like the standard back button button.titleLabel.lineBreakMode = UILineBreakModeTailTruncation; - + // Inset the title on the left and right button.titleEdgeInsets = UIEdgeInsetsMake(0, 6.0, 0, 3.0); // Make the button as high as the passed in image button.frame = CGRectMake(0, 0, 0, buttonImage.size.height); - + // Just like the standard back button, use the title of the previous item as the default back text [self setText:self.topItem.title onBackButton:button]; - + // Set the stretchable images as the background for the button [button setBackgroundImage:buttonImage forState:UIControlStateNormal]; [button setBackgroundImage:buttonHighlightImage forState:UIControlStateHighlighted]; diff --git a/CustomBackButton/Classes/DailyBoothViewController.h b/CustomBackButton/Classes/DailyBoothViewController.h index 6fc3e7a..7458ee1 100644 --- a/CustomBackButton/Classes/DailyBoothViewController.h +++ b/CustomBackButton/Classes/DailyBoothViewController.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 1/11/11. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/CustomBackButton/Classes/DailyBoothViewController.m b/CustomBackButton/Classes/DailyBoothViewController.m index dabf3ff..24f84ed 100644 --- a/CustomBackButton/Classes/DailyBoothViewController.m +++ b/CustomBackButton/Classes/DailyBoothViewController.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 1/11/11. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/CustomBackButton/Classes/InstagramViewController.h b/CustomBackButton/Classes/InstagramViewController.h index 3552f30..44536c0 100644 --- a/CustomBackButton/Classes/InstagramViewController.h +++ b/CustomBackButton/Classes/InstagramViewController.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 1/11/11. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/CustomBackButton/Classes/InstagramViewController.m b/CustomBackButton/Classes/InstagramViewController.m index 52d8c94..5d151de 100644 --- a/CustomBackButton/Classes/InstagramViewController.m +++ b/CustomBackButton/Classes/InstagramViewController.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 1/11/11. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/CustomBackButton/Classes/ReederViewController.h b/CustomBackButton/Classes/ReederViewController.h index e3188f5..cd3a03f 100644 --- a/CustomBackButton/Classes/ReederViewController.h +++ b/CustomBackButton/Classes/ReederViewController.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 1/11/11. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/CustomBackButton/Classes/ReederViewController.m b/CustomBackButton/Classes/ReederViewController.m index b3ffb2d..ec01afc 100644 --- a/CustomBackButton/Classes/ReederViewController.m +++ b/CustomBackButton/Classes/ReederViewController.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 1/11/11. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -38,7 +38,7 @@ - (void)viewDidLoad // Set the nav bar's background [customNavigationBar setBackgroundWith:[UIImage imageNamed:@"BarBackground.png"]]; - + // Instead of a custom back button, use the standard back button with a dark gray tint customNavigationBar.tintColor = [UIColor darkGrayColor]; } diff --git a/CustomBackButton/Classes/RootViewController.h b/CustomBackButton/Classes/RootViewController.h index 55ec41b..2b1b502 100644 --- a/CustomBackButton/Classes/RootViewController.h +++ b/CustomBackButton/Classes/RootViewController.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 1/11/11. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/CustomBackButton/Classes/RootViewController.m b/CustomBackButton/Classes/RootViewController.m index 08b92d2..4cde5ae 100644 --- a/CustomBackButton/Classes/RootViewController.m +++ b/CustomBackButton/Classes/RootViewController.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 1/11/11. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -32,7 +32,7 @@ @implementation RootViewController - (void)viewDidLoad { [super viewDidLoad]; - + self.title = @"Home"; self.tableView.rowHeight = 57.0; @@ -61,11 +61,11 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger - (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] autorelease]; - + cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; cell.textLabel.text = [[tableViewData objectAtIndex:indexPath.row] objectForKey:@"title"]; cell.imageView.image = [UIImage imageNamed:[[tableViewData objectAtIndex:indexPath.row] objectForKey:@"image"]]; diff --git a/CustomBackButton/main.m b/CustomBackButton/main.m index 44f8a8b..93d3b17 100644 --- a/CustomBackButton/main.m +++ b/CustomBackButton/main.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 1/11/11. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -26,7 +26,7 @@ #import int main(int argc, char *argv[]) { - + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, nil, nil); [pool release]; diff --git a/CustomSegmentedControls/Classes/CustomSegmentedControl.h b/CustomSegmentedControls/Classes/CustomSegmentedControl.h index 3d15126..136d24e 100644 --- a/CustomSegmentedControls/Classes/CustomSegmentedControl.h +++ b/CustomSegmentedControls/Classes/CustomSegmentedControl.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/10/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/CustomSegmentedControls/Classes/CustomSegmentedControl.m b/CustomSegmentedControls/Classes/CustomSegmentedControl.m index b4fc930..2c4dc69 100644 --- a/CustomSegmentedControls/Classes/CustomSegmentedControl.m +++ b/CustomSegmentedControls/Classes/CustomSegmentedControl.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/10/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -36,7 +36,7 @@ - (id) initWithSegmentCount:(NSUInteger)segmentCount segmentsize:(CGSize)segment { // The tag allows callers withe multiple controls to distinguish between them self.tag = objectTag; - + // Set the delegate delegate = customSegmentedControlDelegate; @@ -48,7 +48,7 @@ - (id) initWithSegmentCount:(NSUInteger)segmentCount segmentsize:(CGSize)segment // horizontalOffset tracks the proper x value as we add buttons as subviews CGFloat horizontalOffset = 0; - + // Iterate through each segment for (NSUInteger i = 0 ; i < segmentCount ; i++) { @@ -61,7 +61,7 @@ - (id) initWithSegmentCount:(NSUInteger)segmentCount segmentsize:(CGSize)segment [button addTarget:self action:@selector(otherTouchesAction:) forControlEvents:UIControlEventTouchUpOutside]; [button addTarget:self action:@selector(otherTouchesAction:) forControlEvents:UIControlEventTouchDragOutside]; [button addTarget:self action:@selector(otherTouchesAction:) forControlEvents:UIControlEventTouchDragInside]; - + // Add the button to our buttons array [buttons addObject:button]; @@ -107,7 +107,7 @@ -(void) dimAllButtonsExcept:(UIButton*)selectedButton - (void)touchDownAction:(UIButton*)button { [self dimAllButtonsExcept:button]; - + if ([delegate respondsToSelector:@selector(touchDownAtSegmentIndex:)]) [delegate touchDownAtSegmentIndex:[buttons indexOfObject:button]]; } diff --git a/CustomSegmentedControls/Classes/CustomSegmentedControlsAppDelegate.h b/CustomSegmentedControls/Classes/CustomSegmentedControlsAppDelegate.h index 3510e4f..9af2652 100644 --- a/CustomSegmentedControls/Classes/CustomSegmentedControlsAppDelegate.h +++ b/CustomSegmentedControls/Classes/CustomSegmentedControlsAppDelegate.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/10/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/CustomSegmentedControls/Classes/CustomSegmentedControlsAppDelegate.m b/CustomSegmentedControls/Classes/CustomSegmentedControlsAppDelegate.m index 9d08829..debc871 100644 --- a/CustomSegmentedControls/Classes/CustomSegmentedControlsAppDelegate.m +++ b/CustomSegmentedControls/Classes/CustomSegmentedControlsAppDelegate.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/10/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -37,8 +37,8 @@ @implementation CustomSegmentedControlsAppDelegate #pragma mark - #pragma mark Application lifecycle -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. // Add the view controller's view to the window and display. @@ -59,7 +59,7 @@ - (void)applicationWillResignActive:(UIApplication *)application { - (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. + 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, called instead of applicationWillTerminate: when the user quits. */ } diff --git a/CustomSegmentedControls/Classes/CustomSegmentedControlsViewController.h b/CustomSegmentedControls/Classes/CustomSegmentedControlsViewController.h index 9cc6674..72bf05e 100644 --- a/CustomSegmentedControls/Classes/CustomSegmentedControlsViewController.h +++ b/CustomSegmentedControls/Classes/CustomSegmentedControlsViewController.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/10/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/CustomSegmentedControls/Classes/CustomSegmentedControlsViewController.m b/CustomSegmentedControls/Classes/CustomSegmentedControlsViewController.m index f9862c6..2e6890d 100644 --- a/CustomSegmentedControls/Classes/CustomSegmentedControlsViewController.m +++ b/CustomSegmentedControls/Classes/CustomSegmentedControlsViewController.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/10/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -54,7 +54,7 @@ - (void) awakeFromNib buttons = [[NSArray arrayWithObjects: [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObjects:@"One", @"Two", @"Three", nil], @"titles", [NSValue valueWithCGSize:CGSizeMake(80,47)], @"size", @"bottombarblue.png", @"button-image", @"bottombarblue_pressed.png", @"button-highlight-image", @"blue-divider.png", @"divider-image", [NSNumber numberWithFloat:14.0], @"cap-width", nil], [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObjects:@"One", @"Two", nil], @"titles", [NSValue valueWithCGSize:CGSizeMake(80,47)], @"size", @"bottombarblue.png", @"button-image", @"bottombarblue_pressed.png", @"button-highlight-image", @"blue-divider.png", @"divider-image", [NSNumber numberWithFloat:14.0], @"cap-width", nil], - [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObjects:@"One", @"Two", @"Three", nil], @"titles", [NSValue valueWithCGSize:CGSizeMake(100,47)], @"size", @"bottombarredfire.png", @"button-image", @"bottombarredfire_pressed.png", @"button-highlight-image", @"red-divider.png", @"divider-image", [NSNumber numberWithFloat:14.0], @"cap-width", nil], + [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObjects:@"One", @"Two", @"Three", nil], @"titles", [NSValue valueWithCGSize:CGSizeMake(100,47)], @"size", @"bottombarredfire.png", @"button-image", @"bottombarredfire_pressed.png", @"button-highlight-image", @"red-divider.png", @"divider-image", [NSNumber numberWithFloat:14.0], @"cap-width", nil], [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObjects:@"1", @"2", nil], @"titles", [NSValue valueWithCGSize:CGSizeMake(47,47)], @"size", @"bottombarredfire.png", @"button-image", @"bottombarredfire_pressed.png", @"button-highlight-image", @"red-divider.png", @"divider-image", [NSNumber numberWithFloat:14.0], @"cap-width", nil], nil] retain]; } @@ -91,14 +91,14 @@ -(void)addView:(UIView*)subView verticalOffset:(NSUInteger)verticalOffset title: { // Figure out the vertical location based on the offset and heights CGFloat elementVerticalLocation = (VERTICAL_HEIGHT + (VERTICAL_SPACING * 2)) * verticalOffset; - + // Add a label UILabel* label = [[[UILabel alloc] initWithFrame:CGRectMake(HORIZONTAL_OFFSET, elementVerticalLocation + VERTICAL_OFFSET, 0, 0)] autorelease]; label.backgroundColor = [UIColor clearColor]; label.textColor = [UIColor whiteColor]; label.text = title; [label sizeToFit]; - + [self.view addSubview:label]; // Adjust location of new subView and add it @@ -144,10 +144,10 @@ - (UIButton*) buttonFor:(CustomSegmentedControl*)segmentedControl atIndex:(NSUIn UIImage* buttonImage = nil; UIImage* buttonPressedImage = nil; - + CGFloat capWidth = [[data objectForKey:@"cap-width"] floatValue]; CGSize buttonSize = [[data objectForKey:@"size"] CGSizeValue]; - + if (location == CapLeftAndRight) { buttonImage = [[UIImage imageNamed:[data objectForKey:@"button-image"]] stretchableImageWithLeftCapWidth:capWidth topCapHeight:0.0]; @@ -158,7 +158,7 @@ - (UIButton*) buttonFor:(CustomSegmentedControl*)segmentedControl atIndex:(NSUIn buttonImage = [self image:[[UIImage imageNamed:[data objectForKey:@"button-image"]] stretchableImageWithLeftCapWidth:capWidth topCapHeight:0.0] withCap:location capWidth:capWidth buttonWidth:buttonSize.width]; buttonPressedImage = [self image:[[UIImage imageNamed:[data objectForKey:@"button-highlight-image"]] stretchableImageWithLeftCapWidth:capWidth topCapHeight:0.0] withCap:location capWidth:capWidth buttonWidth:buttonSize.width]; } - + UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake(0.0, 0.0, buttonSize.width, buttonSize.height); diff --git a/CustomSegmentedControls/main.m b/CustomSegmentedControls/main.m index 6849be0..36ce6d6 100644 --- a/CustomSegmentedControls/main.m +++ b/CustomSegmentedControls/main.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/10/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -28,7 +28,7 @@ #import int main(int argc, char *argv[]) { - + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, nil, nil); [pool release]; diff --git a/CustomTabBar/Classes/CustomTabBar.h b/CustomTabBar/Classes/CustomTabBar.h index 5a6462a..95c6900 100644 --- a/CustomTabBar/Classes/CustomTabBar.h +++ b/CustomTabBar/Classes/CustomTabBar.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 1/2/11. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/CustomTabBar/Classes/CustomTabBar.m b/CustomTabBar/Classes/CustomTabBar.m index 9503e73..067186c 100644 --- a/CustomTabBar/Classes/CustomTabBar.m +++ b/CustomTabBar/Classes/CustomTabBar.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 1/2/11. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -48,13 +48,13 @@ - (id) initWithItemCount:(NSUInteger)itemCount itemSize:(CGSize)itemSize tag:(NS if (self = [super init]) { self.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth; - + // The tag allows callers withe multiple controls to distinguish between them self.tag = objectTag; - + // Set the delegate delegate = customTabBarDelegate; - + // Add the background image UIImage* backgroundImage = [delegate backgroundImage]; UIImageView* backgroundImageView = [[[UIImageView alloc] initWithImage:backgroundImage] autorelease]; @@ -70,7 +70,7 @@ - (id) initWithItemCount:(NSUInteger)itemCount itemSize:(CGSize)itemSize tag:(NS // horizontalOffset tracks the proper x value as we add buttons as subviews CGFloat horizontalOffset = 0; - + // Iterate through each item for (NSUInteger i = 0 ; i < itemCount ; i++) { @@ -83,7 +83,7 @@ - (id) initWithItemCount:(NSUInteger)itemCount itemSize:(CGSize)itemSize tag:(NS [button addTarget:self action:@selector(otherTouchesAction:) forControlEvents:UIControlEventTouchUpOutside]; [button addTarget:self action:@selector(otherTouchesAction:) forControlEvents:UIControlEventTouchDragOutside]; [button addTarget:self action:@selector(otherTouchesAction:) forControlEvents:UIControlEventTouchDragInside]; - + // Add the button to our buttons array [buttons addObject:button]; @@ -92,7 +92,7 @@ - (id) initWithItemCount:(NSUInteger)itemCount itemSize:(CGSize)itemSize tag:(NS // Add the button as our subview [self addSubview:button]; - + // Advance the horizontal offset horizontalOffset = horizontalOffset + itemSize.width; } @@ -110,7 +110,7 @@ -(void) dimAllButtonsExcept:(UIButton*)selectedButton button.selected = YES; button.highlighted = button.selected ? NO : YES; button.tag = SELECTED_ITEM_TAG; - + UIImageView* tabBarArrow = (UIImageView*)[self viewWithTag:TAB_ARROW_IMAGE_TAG]; NSUInteger selectedIndex = [buttons indexOfObjectIdenticalTo:button]; if (tabBarArrow) @@ -139,7 +139,7 @@ -(void) dimAllButtonsExcept:(UIButton*)selectedButton - (void)touchDownAction:(UIButton*)button { [self dimAllButtonsExcept:button]; - + if ([delegate respondsToSelector:@selector(touchDownAtItemAtIndex:)]) [delegate touchDownAtItemAtIndex:[buttons indexOfObject:button]]; } @@ -161,7 +161,7 @@ - (void) selectItemAtIndex:(NSInteger)index { // Get the right button to select UIButton* button = [buttons objectAtIndex:index]; - + [self dimAllButtonsExcept:button]; } @@ -170,19 +170,19 @@ - (void) glowItemAtIndex:(NSInteger)index { // Get the right button. We'll use to calculate where to put the glow UIButton* button = [buttons objectAtIndex:index]; - + // Ask the delegate for the glow image UIImage* glowImage = [delegate glowImage]; - + // Create the image view that will hold the glow image UIImageView* glowImageView = [[[UIImageView alloc] initWithImage:glowImage] autorelease]; - + // Center the glow image at the center of the button horizontally and at the bottom of the button vertically glowImageView.frame = CGRectMake(button.frame.size.width/2.0 - glowImage.size.width/2.0, button.frame.origin.y + button.frame.size.height - glowImage.size.height, glowImage.size.width, glowImage.size.height); // Set the glow image view's tag so we can find it later when we want to remove the glow glowImageView.tag = GLOW_IMAGE_TAG; - + // Add the glow image view to the button [button addSubview:glowImageView]; } @@ -201,14 +201,14 @@ - (void) removeGlowAtIndex:(NSInteger)index - (CGFloat) horizontalLocationFor:(NSUInteger)tabIndex { UIImageView* tabBarArrow = (UIImageView*)[self viewWithTag:TAB_ARROW_IMAGE_TAG]; - + // A single tab item's width is the same as the button's width UIButton* button = [buttons objectAtIndex:tabIndex]; CGFloat tabItemWidth = button.frame.size.width; // A half width is tabItemWidth divided by 2 minus half the width of the arrow CGFloat halfTabItemWidth = (tabItemWidth / 2.0) - (tabBarArrow.frame.size.width / 2.0); - + // The horizontal location is the index times the width plus a half width return button.frame.origin.x + halfTabItemWidth; } @@ -247,9 +247,9 @@ - (UIButton*) buttonAtIndex:(NSUInteger)itemIndex width:(CGFloat)width // Ask the delegate for the highlighted/selected state image & set it as the selected background state [button setBackgroundImage:[delegate selectedItemImage] forState:UIControlStateHighlighted]; [button setBackgroundImage:[delegate selectedItemImage] forState:UIControlStateSelected]; - + button.adjustsImageWhenHighlighted = NO; - + return button; } @@ -258,10 +258,10 @@ -(UIImage*) tabBarImage:(UIImage*)startImage size:(CGSize)targetSize backgroundI { // The background is either the passed in background image (for the blue selected state) or gray (for the non-selected state) UIImage* backgroundImage = [self tabBarBackgroundImageWithSize:startImage.size backgroundImage:backgroundImageSource]; - + // Convert the passed in image to a white backround image with a black fill UIImage* bwImage = [self blackFilledImageWithWhiteBackgroundUsing:startImage]; - + // Create an image mask CGImageRef imageMask = CGImageMaskCreate(CGImageGetWidth(bwImage.CGImage), CGImageGetHeight(bwImage.CGImage), @@ -278,17 +278,17 @@ -(UIImage*) tabBarImage:(UIImage*)startImage size:(CGSize)targetSize backgroundI // Cleanup CGImageRelease(imageMask); CGImageRelease(tabBarImageRef); - + // Create a new context with the right size UIGraphicsBeginImageContextWithOptions(targetSize, NO, 0.0); // Draw the new tab bar image at the center [tabBarImage drawInRect:CGRectMake((targetSize.width/2.0) - (startImage.size.width/2.0), (targetSize.height/2.0) - (startImage.size.height/2.0), startImage.size.width, startImage.size.height)]; - + // Generate a new image UIImage* resultImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); - + return resultImage; } @@ -318,7 +318,7 @@ -(UIImage*) blackFilledImageWithWhiteBackgroundUsing:(UIImage*)startImage // Cleanup CGContextRelease(context); CGImageRelease(newCGImage); - + return newImage; } @@ -339,7 +339,7 @@ -(UIImage*) tabBarBackgroundImageWithSize:(CGSize)targetSize backgroundImage:(UI UIImage* finalBackgroundImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); - + return finalBackgroundImage; } @@ -358,7 +358,7 @@ - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrie // Advance the horizontal offset horizontalOffset = horizontalOffset + itemWidth; } - + // Move the arrow to the new button location UIButton* selectedButton = (UIButton*)[self viewWithTag:SELECTED_ITEM_TAG]; [self dimAllButtonsExcept:selectedButton]; diff --git a/CustomTabBar/Classes/CustomTabBarAppDelegate.h b/CustomTabBar/Classes/CustomTabBarAppDelegate.h index 71ff909..a941f6a 100644 --- a/CustomTabBar/Classes/CustomTabBarAppDelegate.h +++ b/CustomTabBar/Classes/CustomTabBarAppDelegate.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 1/2/11. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/CustomTabBar/Classes/CustomTabBarAppDelegate.m b/CustomTabBar/Classes/CustomTabBarAppDelegate.m index a8b37e9..89e159d 100644 --- a/CustomTabBar/Classes/CustomTabBarAppDelegate.m +++ b/CustomTabBar/Classes/CustomTabBarAppDelegate.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 1/2/11. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -37,8 +37,8 @@ @implementation CustomTabBarAppDelegate #pragma mark - #pragma mark Application lifecycle -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. // Add the view controller's view to the window and display. @@ -59,7 +59,7 @@ - (void)applicationWillResignActive:(UIApplication *)application { - (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. + 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, called instead of applicationWillTerminate: when the user quits. */ } diff --git a/CustomTabBar/Classes/CustomTabBarViewController.h b/CustomTabBar/Classes/CustomTabBarViewController.h index ed74937..e644d0c 100644 --- a/CustomTabBar/Classes/CustomTabBarViewController.h +++ b/CustomTabBar/Classes/CustomTabBarViewController.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 1/2/11. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/CustomTabBar/Classes/CustomTabBarViewController.m b/CustomTabBar/Classes/CustomTabBarViewController.m index 7a430da..bf9f93e 100644 --- a/CustomTabBar/Classes/CustomTabBarViewController.m +++ b/CustomTabBar/Classes/CustomTabBarViewController.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 1/2/11. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -66,14 +66,14 @@ - (void)viewDidLoad // Use the TabBarGradient image to figure out the tab bar's height (22x2=44) UIImage* tabBarGradient = [UIImage imageNamed:@"TabBarGradient.png"]; - + // Create a custom tab bar passing in the number of items, the size of each item and setting ourself as the delegate self.tabBar = [[[CustomTabBar alloc] initWithItemCount:tabBarItems.count itemSize:CGSizeMake(self.view.frame.size.width/tabBarItems.count, tabBarGradient.size.height*2) tag:0 delegate:self] autorelease]; - + // Place the tab bar at the bottom of our view tabBar.frame = CGRectMake(0,self.view.frame.size.height-(tabBarGradient.size.height*2),self.view.frame.size.width, tabBarGradient.size.height*2); [self.view addSubview:tabBar]; - + // Select the first tab [tabBar selectItemAtIndex:0]; [self touchDownAtItemAtIndex:0]; @@ -96,18 +96,18 @@ - (UIImage*) backgroundImage CGFloat width = self.view.frame.size.width; // Get the image that will form the top of the background UIImage* topImage = [UIImage imageNamed:@"TabBarGradient.png"]; - + // Create a new image context UIGraphicsBeginImageContextWithOptions(CGSizeMake(width, topImage.size.height*2), NO, 0.0); - + // Create a stretchable image for the top of the background and draw it UIImage* stretchedTopImage = [topImage stretchableImageWithLeftCapWidth:0 topCapHeight:0]; [stretchedTopImage drawInRect:CGRectMake(0, 0, width, topImage.size.height)]; - + // Draw a solid black color for the bottom of the background [[UIColor blackColor] set]; CGContextFillRect(UIGraphicsGetCurrentContext(), CGRectMake(0, topImage.size.height, width, topImage.size.height)); - + // Generate a new image UIImage* resultImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); @@ -125,7 +125,7 @@ - (UIImage*) selectedItemBackgroundImage - (UIImage*) glowImage { UIImage* tabBarGlow = [UIImage imageNamed:@"TabBarGlow.png"]; - + // Create a new image using the TabBarGlow image but offset 4 pixels down UIGraphicsBeginImageContextWithOptions(CGSizeMake(tabBarGlow.size.width, tabBarGlow.size.height-4.0), NO, 0.0); @@ -148,12 +148,12 @@ - (UIImage*) selectedItemImage UIGraphicsBeginImageContextWithOptions(tabBarItemSize, NO, 0.0); // Create a stretchable image using the TabBarSelection image but offset 4 pixels down - [[[UIImage imageNamed:@"TabBarSelection.png"] stretchableImageWithLeftCapWidth:4.0 topCapHeight:0] drawInRect:CGRectMake(0, 4.0, tabBarItemSize.width, tabBarItemSize.height-4.0)]; + [[[UIImage imageNamed:@"TabBarSelection.png"] stretchableImageWithLeftCapWidth:4.0 topCapHeight:0] drawInRect:CGRectMake(0, 4.0, tabBarItemSize.width, tabBarItemSize.height-4.0)]; // Generate a new image UIImage* selectedItemImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); - + return selectedItemImage; } @@ -167,7 +167,7 @@ - (void) touchDownAtItemAtIndex:(NSUInteger)itemIndex // Remove the current view controller's view UIView* currentView = [self.view viewWithTag:SELECTED_VIEW_CONTROLLER_TAG]; [currentView removeFromSuperview]; - + // Get the right view controller NSDictionary* data = [tabBarItems objectAtIndex:itemIndex]; UIViewController* viewController = [data objectForKey:@"viewController"]; @@ -180,13 +180,13 @@ - (void) touchDownAtItemAtIndex:(NSUInteger)itemIndex // Se the tag so we can find it later viewController.view.tag = SELECTED_VIEW_CONTROLLER_TAG; - + // Add the new view controller's view [self.view insertSubview:viewController.view belowSubview:tabBar]; - + // In 1 second glow the selected tab [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(addGlowTimerFireMethod:) userInfo:[NSNumber numberWithInteger:itemIndex] repeats:NO]; - + } - (void)addGlowTimerFireMethod:(NSTimer*)theTimer @@ -196,7 +196,7 @@ - (void)addGlowTimerFireMethod:(NSTimer*)theTimer { [tabBar removeGlowAtIndex:i]; } - + // Then add it to this tab bar item [tabBar glowItemAtIndex:[[theTimer userInfo] integerValue]]; } diff --git a/CustomTabBar/main.m b/CustomTabBar/main.m index 3f8c5b0..8261b21 100644 --- a/CustomTabBar/main.m +++ b/CustomTabBar/main.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 1/2/11. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -28,7 +28,7 @@ #import int main(int argc, char *argv[]) { - + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, nil, nil); [pool release]; diff --git a/CustomTabBarNotification/Classes/BaseViewController.m b/CustomTabBarNotification/Classes/BaseViewController.m index 3b398ee..517cf45 100644 --- a/CustomTabBarNotification/Classes/BaseViewController.m +++ b/CustomTabBarNotification/Classes/BaseViewController.m @@ -53,7 +53,7 @@ -(void) addCenterButtonWithImage:(UIImage*)buttonImage highlightImage:(UIImage*) center.y = center.y - heightDifference/2.0; button.center = center; } - + [self.view addSubview:button]; } diff --git a/CustomTabBarNotification/Classes/CustomNavigationBar.m b/CustomTabBarNotification/Classes/CustomNavigationBar.m index 8078613..5c2a746 100644 --- a/CustomTabBarNotification/Classes/CustomNavigationBar.m +++ b/CustomTabBarNotification/Classes/CustomNavigationBar.m @@ -73,25 +73,25 @@ -(UIButton*) backButtonWith:(UIImage*)backButtonImage highlight:(UIImage*)backBu // Create a custom button UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom]; - + // Set the title to use the same font and shadow as the standard back button button.titleLabel.font = [UIFont boldSystemFontOfSize:[UIFont smallSystemFontSize]]; button.titleLabel.textColor = [UIColor whiteColor]; button.titleLabel.shadowOffset = CGSizeMake(0,-1); button.titleLabel.shadowColor = [UIColor darkGrayColor]; - + // Set the break mode to truncate at the end like the standard back button button.titleLabel.lineBreakMode = UILineBreakModeTailTruncation; - + // Inset the title on the left and right button.titleEdgeInsets = UIEdgeInsetsMake(0, 6.0, 0, 3.0); // Make the button as high as the passed in image button.frame = CGRectMake(0, 0, 0, buttonImage.size.height); - + // Just like the standard back button, use the title of the previous item as the default back text [self setText:self.topItem.title onBackButton:button]; - + // Set the stretchable images as the background for the button [button setBackgroundImage:buttonImage forState:UIControlStateNormal]; [button setBackgroundImage:buttonHighlightImage forState:UIControlStateHighlighted]; diff --git a/CustomTabBarNotification/Classes/CustomTabBarNotificationAppDelegate.h b/CustomTabBarNotification/Classes/CustomTabBarNotificationAppDelegate.h index 764abd8..471af9c 100644 --- a/CustomTabBarNotification/Classes/CustomTabBarNotificationAppDelegate.h +++ b/CustomTabBarNotification/Classes/CustomTabBarNotificationAppDelegate.h @@ -27,7 +27,7 @@ #import @interface CustomTabBarNotificationAppDelegate : NSObject { - + UIWindow *window; UINavigationController *navigationController; } diff --git a/CustomTabBarNotification/Classes/CustomTabBarNotificationAppDelegate.m b/CustomTabBarNotification/Classes/CustomTabBarNotificationAppDelegate.m index d8eba9d..0fbf0ef 100644 --- a/CustomTabBarNotification/Classes/CustomTabBarNotificationAppDelegate.m +++ b/CustomTabBarNotification/Classes/CustomTabBarNotificationAppDelegate.m @@ -36,10 +36,10 @@ @implementation CustomTabBarNotificationAppDelegate #pragma mark - #pragma mark Application lifecycle -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. - + // Set the navigation controller as the window's root view controller and display. self.window.rootViewController = self.navigationController; [self.window makeKeyAndVisible]; @@ -64,7 +64,7 @@ - (void)applicationWillResignActive:(UIApplication *)application { - (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. + 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, called instead of applicationWillTerminate: when the user quits. */ } diff --git a/CustomTabBarNotification/Classes/InstagramViewController.h b/CustomTabBarNotification/Classes/InstagramViewController.h index 030fb60..5884fb8 100644 --- a/CustomTabBarNotification/Classes/InstagramViewController.h +++ b/CustomTabBarNotification/Classes/InstagramViewController.h @@ -33,7 +33,7 @@ IBOutlet UILabel* commentCountLabel; IBOutlet UILabel* likeCountLabel; IBOutlet UILabel* followerCountLabel; - + UIButton* showButton; UIButton* hideButton; } diff --git a/CustomTabBarNotification/Classes/InstagramViewController.m b/CustomTabBarNotification/Classes/InstagramViewController.m index 9ccdd61..92f6730 100644 --- a/CustomTabBarNotification/Classes/InstagramViewController.m +++ b/CustomTabBarNotification/Classes/InstagramViewController.m @@ -76,7 +76,7 @@ -(void)willAppearIn:(UINavigationController *)navigationController frame.origin.y = self.view.frame.size.height / 4.0; showButton.frame = frame; [self.view addSubview:showButton]; - + self.hideButton = [self buttonWithText:@"Hide Notification"]; [hideButton addTarget:self action:@selector(hideNotificationView:) forControlEvents:UIControlEventTouchUpInside]; hideButton.center = self.view.center; @@ -84,7 +84,7 @@ -(void)willAppearIn:(UINavigationController *)navigationController frame.origin.y = self.view.frame.size.height / 2.0; hideButton.frame = frame; [self.view addSubview:hideButton]; - + showButton.enabled = YES; hideButton.enabled = NO; } @@ -94,7 +94,7 @@ -(UIButton*) buttonWithText:(NSString*) text UIImage* buttonImage = [UIImage imageNamed:@"button-normal.png"]; UIImage* buttonPressedImage = [UIImage imageNamed:@"button-highlighted.png"]; UIImage* buttonDisabledImage = [UIImage imageNamed:@"button-disabled.png"]; - + UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake(0.0, 0.0, buttonImage.size.width, buttonImage.size.height); @@ -105,7 +105,7 @@ -(UIButton*) buttonWithText:(NSString*) text [button setBackgroundImage:buttonPressedImage forState:UIControlStateHighlighted]; [button setBackgroundImage:buttonPressedImage forState:UIControlStateSelected]; [button setBackgroundImage:buttonDisabledImage forState:UIControlStateDisabled]; - + return button; } @@ -115,7 +115,7 @@ - (CGFloat) horizontalLocationFor:(NSUInteger)tabIndex CGFloat tabItemWidth = self.tabBar.frame.size.width / self.tabBar.items.count; // A half width is tabItemWidth divided by 2 minus half the width of the notification view CGFloat halfTabItemWidth = (tabItemWidth / 2.0) - (notificationView.frame.size.width / 2.0); - + // The horizontal location is the index times the width plus a half width return (tabIndex * tabItemWidth) + halfTabItemWidth; } @@ -141,12 +141,12 @@ - (IBAction)showNotificationView:(id)sender { showButton.enabled = NO; hideButton.enabled = YES; - + // Set the values for the number of comments, likes and followers commentCountLabel.text = @"2"; likeCountLabel.text = @"1"; followerCountLabel.text = @"3"; - + // Show the notification view over the 3rd tab bar item [self showNotificationViewFor:3]; } @@ -155,7 +155,7 @@ - (IBAction)hideNotificationView:(id)sender { showButton.enabled = YES; hideButton.enabled = NO; - + [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.5]; notificationView.alpha = 0.0; diff --git a/CustomTabBarNotification/main.m b/CustomTabBarNotification/main.m index 414f3c9..61b0203 100644 --- a/CustomTabBarNotification/main.m +++ b/CustomTabBarNotification/main.m @@ -27,7 +27,7 @@ #import int main(int argc, char *argv[]) { - + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, nil, nil); [pool release]; diff --git a/RaisedCenterTabBar/Classes/BaseViewController.h b/RaisedCenterTabBar/Classes/BaseViewController.h index 1842edd..ef58cfb 100644 --- a/RaisedCenterTabBar/Classes/BaseViewController.h +++ b/RaisedCenterTabBar/Classes/BaseViewController.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/15/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/RaisedCenterTabBar/Classes/BaseViewController.m b/RaisedCenterTabBar/Classes/BaseViewController.m index 7a20eb9..f0afdb9 100644 --- a/RaisedCenterTabBar/Classes/BaseViewController.m +++ b/RaisedCenterTabBar/Classes/BaseViewController.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/15/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -55,7 +55,7 @@ -(void) addCenterButtonWithImage:(UIImage*)buttonImage highlightImage:(UIImage*) center.y = center.y - heightDifference/2.0; button.center = center; } - + [self.view addSubview:button]; } diff --git a/RaisedCenterTabBar/Classes/DailyBoothViewController.h b/RaisedCenterTabBar/Classes/DailyBoothViewController.h index acaf14e..08290ca 100644 --- a/RaisedCenterTabBar/Classes/DailyBoothViewController.h +++ b/RaisedCenterTabBar/Classes/DailyBoothViewController.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/15/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/RaisedCenterTabBar/Classes/DailyBoothViewController.m b/RaisedCenterTabBar/Classes/DailyBoothViewController.m index f765cda..d33fc49 100644 --- a/RaisedCenterTabBar/Classes/DailyBoothViewController.m +++ b/RaisedCenterTabBar/Classes/DailyBoothViewController.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/15/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/RaisedCenterTabBar/Classes/InstagramViewController.h b/RaisedCenterTabBar/Classes/InstagramViewController.h index bd6d659..76e73c3 100644 --- a/RaisedCenterTabBar/Classes/InstagramViewController.h +++ b/RaisedCenterTabBar/Classes/InstagramViewController.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/15/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/RaisedCenterTabBar/Classes/InstagramViewController.m b/RaisedCenterTabBar/Classes/InstagramViewController.m index cabdea7..7a44638 100644 --- a/RaisedCenterTabBar/Classes/InstagramViewController.m +++ b/RaisedCenterTabBar/Classes/InstagramViewController.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/15/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/RaisedCenterTabBar/Classes/PathViewController.h b/RaisedCenterTabBar/Classes/PathViewController.h index 34999ed..c9a4704 100644 --- a/RaisedCenterTabBar/Classes/PathViewController.h +++ b/RaisedCenterTabBar/Classes/PathViewController.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/15/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/RaisedCenterTabBar/Classes/PathViewController.m b/RaisedCenterTabBar/Classes/PathViewController.m index 53f81c7..d5bff32 100644 --- a/RaisedCenterTabBar/Classes/PathViewController.m +++ b/RaisedCenterTabBar/Classes/PathViewController.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/15/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/RaisedCenterTabBar/Classes/RaisedCenterTabBarAppDelegate.h b/RaisedCenterTabBar/Classes/RaisedCenterTabBarAppDelegate.h index a342ed0..136d201 100644 --- a/RaisedCenterTabBar/Classes/RaisedCenterTabBarAppDelegate.h +++ b/RaisedCenterTabBar/Classes/RaisedCenterTabBarAppDelegate.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/15/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/RaisedCenterTabBar/Classes/RaisedCenterTabBarAppDelegate.m b/RaisedCenterTabBar/Classes/RaisedCenterTabBarAppDelegate.m index 3631063..95bade8 100644 --- a/RaisedCenterTabBar/Classes/RaisedCenterTabBarAppDelegate.m +++ b/RaisedCenterTabBar/Classes/RaisedCenterTabBarAppDelegate.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/15/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -65,7 +65,7 @@ - (void)applicationWillResignActive:(UIApplication *)application { - (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. + 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, called instead of applicationWillTerminate: when the user quits. */ } diff --git a/RaisedCenterTabBar/Classes/RootViewController.h b/RaisedCenterTabBar/Classes/RootViewController.h index d8b5564..7b4052a 100644 --- a/RaisedCenterTabBar/Classes/RootViewController.h +++ b/RaisedCenterTabBar/Classes/RootViewController.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/15/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/RaisedCenterTabBar/Classes/RootViewController.m b/RaisedCenterTabBar/Classes/RootViewController.m index 4e7fe81..927aa05 100644 --- a/RaisedCenterTabBar/Classes/RootViewController.m +++ b/RaisedCenterTabBar/Classes/RootViewController.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/15/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -35,7 +35,7 @@ @implementation RootViewController - (void)viewDidLoad { [super viewDidLoad]; - + self.title = @"Home"; self.tableView.rowHeight = 57.0; @@ -53,11 +53,11 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger - (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] autorelease]; - + cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; cell.textLabel.text = [[tableViewData objectAtIndex:indexPath.row] objectForKey:@"title"]; cell.imageView.image = [UIImage imageNamed:[[tableViewData objectAtIndex:indexPath.row] objectForKey:@"image"]]; diff --git a/RaisedCenterTabBar/main.m b/RaisedCenterTabBar/main.m index ce3135a..e706476 100644 --- a/RaisedCenterTabBar/main.m +++ b/RaisedCenterTabBar/main.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/15/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -28,7 +28,7 @@ #import int main(int argc, char *argv[]) { - + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, nil, nil); [pool release]; diff --git a/SideSwipeTableView/Classes/RootViewController.m b/SideSwipeTableView/Classes/RootViewController.m index c4caa09..74abec6 100644 --- a/SideSwipeTableView/Classes/RootViewController.m +++ b/SideSwipeTableView/Classes/RootViewController.m @@ -23,7 +23,7 @@ @implementation RootViewController - (void)viewDidLoad { [super viewDidLoad]; - + // Setup the title and image for each button within the side swipe view buttonData = [[NSArray arrayWithObjects: [NSDictionary dictionaryWithObjectsAndKeys:@"Reply", @"title", @"reply.png", @"image", nil], @@ -58,7 +58,7 @@ - (void) setupSideSwipeView { // Create the button UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom]; - + // Make sure the button ends up in the right place when the cell is resized button.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleTopMargin; @@ -72,16 +72,16 @@ - (void) setupSideSwipeView // [button setBackgroundImage:buttonImage forState:UIControlStateNormal]; UIImage* grayImage = [self imageFilledWith:[UIColor colorWithWhite:0.9 alpha:1.0] using:buttonImage]; [button setImage:grayImage forState:UIControlStateNormal]; - + // Add a touch up inside action [button addTarget:self action:@selector(touchUpInsideAction:) forControlEvents:UIControlEventTouchUpInside]; // Keep track of the buttons so we know the proper text to display in the touch up inside action [buttons addObject:button]; - + // Add the button to the side swipe view [self.sideSwipeView addSubview:button]; - + // Move the left edge in prepartion for the next button leftEdge = leftEdge + buttonImage.size.width + BUTTON_SPACING; } @@ -115,7 +115,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa - (IBAction) touchUpInsideAction:(UIButton*)button { NSIndexPath* indexPath = [tableView indexPathForCell:sideSwipeCell]; - + NSUInteger index = [buttons indexOfObject:button]; NSDictionary* buttonInfo = [buttonData objectAtIndex:index]; [[[[UIAlertView alloc] initWithTitle:[NSString stringWithFormat: @"%@ on cell %d", [buttonInfo objectForKey:@"title"], indexPath.row] @@ -123,7 +123,7 @@ - (IBAction) touchUpInsideAction:(UIButton*)button delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil] autorelease] show]; - + [self removeSideSwipeView:YES]; } @@ -151,7 +151,7 @@ -(UIImage*) imageFilledWith:(UIColor*)color using:(UIImage*)startImage // Cleanup CGContextRelease(context); CGImageRelease(newCGImage); - + return newImage; } diff --git a/SideSwipeTableView/Classes/SideSwipeTableViewAppDelegate.h b/SideSwipeTableView/Classes/SideSwipeTableViewAppDelegate.h index d7657f9..924d301 100644 --- a/SideSwipeTableView/Classes/SideSwipeTableViewAppDelegate.h +++ b/SideSwipeTableView/Classes/SideSwipeTableViewAppDelegate.h @@ -9,7 +9,7 @@ #import @interface SideSwipeTableViewAppDelegate : NSObject { - + UIWindow *window; UINavigationController *navigationController; } diff --git a/SideSwipeTableView/Classes/SideSwipeTableViewAppDelegate.m b/SideSwipeTableView/Classes/SideSwipeTableViewAppDelegate.m index 20b1c10..07aec97 100644 --- a/SideSwipeTableView/Classes/SideSwipeTableViewAppDelegate.m +++ b/SideSwipeTableView/Classes/SideSwipeTableViewAppDelegate.m @@ -19,10 +19,10 @@ @implementation SideSwipeTableViewAppDelegate #pragma mark - #pragma mark Application lifecycle -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. - + // Set the navigation controller as the window's root view controller and display. self.window.rootViewController = self.navigationController; [self.window makeKeyAndVisible]; @@ -41,7 +41,7 @@ - (void)applicationWillResignActive:(UIApplication *)application { - (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. + 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, called instead of applicationWillTerminate: when the user quits. */ } diff --git a/SideSwipeTableView/Classes/SideSwipeTableViewCell.m b/SideSwipeTableView/Classes/SideSwipeTableViewCell.m index 9c56305..44a5844 100644 --- a/SideSwipeTableView/Classes/SideSwipeTableViewCell.m +++ b/SideSwipeTableView/Classes/SideSwipeTableViewCell.m @@ -16,10 +16,10 @@ -(UITableView*)getTableView:(UIView*)theView { if (!theView.superview) return nil; - + if ([theView.superview isKindOfClass:[UITableView class]]) return (UITableView*)theView.superview; - + return [self getTableView:theView.superview]; } diff --git a/SideSwipeTableView/Classes/SideSwipeTableViewController.m b/SideSwipeTableView/Classes/SideSwipeTableViewController.m index 9fd7051..f7efda4 100644 --- a/SideSwipeTableView/Classes/SideSwipeTableViewController.m +++ b/SideSwipeTableView/Classes/SideSwipeTableViewController.m @@ -40,7 +40,7 @@ - (void)viewDidLoad - (BOOL) gestureRecognizersSupported { if (!USE_GESTURE_RECOGNIZERS) return NO; - + // Apple's docs: Although this class was publicly available starting with iOS 3.2, it was in development a short period prior to that // check if it responds to the selector locationInView:. This method was not added to the class until iOS 3.2. return [[[[UISwipeGestureRecognizer alloc] init] autorelease] respondsToSelector:@selector(locationInView:)]; @@ -50,7 +50,7 @@ - (void) setupGestureRecognizers { // Do nothing under 3.x if (![self gestureRecognizersSupported]) return; - + // Setup a right swipe gesture recognizer UISwipeGestureRecognizer* rightSwipeGestureRecognizer = [[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeRight:)] autorelease]; rightSwipeGestureRecognizer.direction = UISwipeGestureRecognizerDirectionRight; @@ -83,17 +83,17 @@ - (void)swipe:(UISwipeGestureRecognizer *)recognizer direction:(UISwipeGestureRe CGPoint location = [recognizer locationInView:tableView]; NSIndexPath* indexPath = [tableView indexPathForRowAtPoint:location]; UITableViewCell* cell = [tableView cellForRowAtIndexPath:indexPath]; - + // If we are already showing the swipe view, remove it if (cell.frame.origin.x != 0) { [self removeSideSwipeView:YES]; return; } - + // Make sure we are starting out with the side swipe view and cell in the proper location [self removeSideSwipeView:NO]; - + // If this isn't the cell that already has thew side swipe view and we aren't in the middle of animating // then start animating in the the side swipe view if (cell!= sideSwipeCell && !animatingSideSwipe) @@ -106,13 +106,13 @@ - (void)tableView:(UITableView *)theTableView willBeginEditingRowAtIndexPath:(NS { // If we are using gestures, then don't do anything if ([self gestureRecognizersSupported]) return; - + // Get the table view cell where the swipe occured UITableViewCell* cell = [theTableView cellForRowAtIndexPath:indexPath]; // Make sure we are starting out with the side swipe view and cell in the proper location [self removeSideSwipeView:NO]; - + // If this isn't the cell that already has thew side swipe view and we aren't in the middle of animating // then start animating in the the side swipe view. We don't have access to the direction, so we always assume right if (cell!= sideSwipeCell && !animatingSideSwipe) @@ -141,7 +141,7 @@ - (void) addSwipeViewTo:(UITableViewCell*)cell direction:(UISwipeGestureRecogniz // Add the side swipe view to the table below the cell [tableView insertSubview:sideSwipeView belowSubview:cell]; - + // Remember which cell the side swipe view is displayed on and the swipe direction self.sideSwipeCell = cell; sideSwipeDirection = direction; @@ -210,7 +210,7 @@ - (void) removeSideSwipeView:(BOOL)animated { // Make sure we have a cell where the side swipe view appears and that we aren't in the middle of animating if (!sideSwipeCell || animatingSideSwipe) return; - + if (animated) { // The first step in a bounce animation is to move the side swipe view a bit offscreen diff --git a/SideSwipeTableView/main.m b/SideSwipeTableView/main.m index 4ebf816..0fbff50 100644 --- a/SideSwipeTableView/main.m +++ b/SideSwipeTableView/main.m @@ -9,7 +9,7 @@ #import int main(int argc, char *argv[]) { - + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, nil, nil); [pool release]; diff --git a/StretchableImages/Classes/StretchableImagesAppDelegate.h b/StretchableImages/Classes/StretchableImagesAppDelegate.h index 89fa152..fc942a2 100644 --- a/StretchableImages/Classes/StretchableImagesAppDelegate.h +++ b/StretchableImages/Classes/StretchableImagesAppDelegate.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/8/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/StretchableImages/Classes/StretchableImagesAppDelegate.m b/StretchableImages/Classes/StretchableImagesAppDelegate.m index adee876..50934aa 100644 --- a/StretchableImages/Classes/StretchableImagesAppDelegate.m +++ b/StretchableImages/Classes/StretchableImagesAppDelegate.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/8/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -37,7 +37,7 @@ @implementation StretchableImagesAppDelegate #pragma mark - #pragma mark Application lifecycle -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. @@ -59,7 +59,7 @@ - (void)applicationWillResignActive:(UIApplication *)application { - (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. + 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, called instead of applicationWillTerminate: when the user quits. */ } diff --git a/StretchableImages/Classes/StretchableImagesViewController.h b/StretchableImages/Classes/StretchableImagesViewController.h index 2af0634..3d930f2 100644 --- a/StretchableImages/Classes/StretchableImagesViewController.h +++ b/StretchableImages/Classes/StretchableImagesViewController.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/8/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/StretchableImages/Classes/StretchableImagesViewController.m b/StretchableImages/Classes/StretchableImagesViewController.m index 2315bf3..3d3d984 100644 --- a/StretchableImages/Classes/StretchableImagesViewController.m +++ b/StretchableImages/Classes/StretchableImagesViewController.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/8/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -56,7 +56,7 @@ - (void)viewDidLoad UIImage* buttonImage = [[UIImage imageNamed:@"button.png"] stretchableImageWithLeftCapWidth:5.0 topCapHeight:0.0]; UIImage* buttonPressedImage = [[UIImage imageNamed:@"button-press.png"] stretchableImageWithLeftCapWidth:5.0 topCapHeight:0.0]; - + // A button stretched with separate images for normal and highlighted states UIButton* shortButton = [UIButton buttonWithType:UIButtonTypeCustom]; shortButton.frame = CGRectMake(0.0, 0.0, 100.0, buttonImage.size.height); @@ -78,13 +78,13 @@ -(void)addView:(UIView*)subView verticalOffset:(NSUInteger)verticalOffset title: { // Figure out the vertical location based on the offset and heights CGFloat elementVerticalLocation = (VERTICAL_HEIGHT + (VERTICAL_SPACING * 2)) * verticalOffset; - + // Add a label UILabel* label = [[[UILabel alloc] initWithFrame:CGRectMake(HORIZONTAL_OFFSET, elementVerticalLocation + VERTICAL_OFFSET, 0, 0)] autorelease]; label.backgroundColor = [UIColor clearColor]; label.text = title; [label sizeToFit]; - + [self.view addSubview:label]; // Adjust location of new subView and add it diff --git a/StretchableImages/main.m b/StretchableImages/main.m index 8257451..8533902 100644 --- a/StretchableImages/main.m +++ b/StretchableImages/main.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/8/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -28,7 +28,7 @@ #import int main(int argc, char *argv[]) { - + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, nil, nil); [pool release]; diff --git a/TabBarAnimation/Classes/FirstViewController.h b/TabBarAnimation/Classes/FirstViewController.h index 6f0de51..0e9b1dc 100644 --- a/TabBarAnimation/Classes/FirstViewController.h +++ b/TabBarAnimation/Classes/FirstViewController.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/16/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/TabBarAnimation/Classes/FirstViewController.m b/TabBarAnimation/Classes/FirstViewController.m index aff85d6..f065461 100644 --- a/TabBarAnimation/Classes/FirstViewController.m +++ b/TabBarAnimation/Classes/FirstViewController.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/16/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -66,7 +66,7 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface - (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. } diff --git a/TabBarAnimation/Classes/TabBarAnimationAppDelegate.h b/TabBarAnimation/Classes/TabBarAnimationAppDelegate.h index 2bad4a0..338a3fa 100644 --- a/TabBarAnimation/Classes/TabBarAnimationAppDelegate.h +++ b/TabBarAnimation/Classes/TabBarAnimationAppDelegate.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/16/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/TabBarAnimation/Classes/TabBarAnimationAppDelegate.m b/TabBarAnimation/Classes/TabBarAnimationAppDelegate.m index 9c7a35a..51c7edb 100644 --- a/TabBarAnimation/Classes/TabBarAnimationAppDelegate.m +++ b/TabBarAnimation/Classes/TabBarAnimationAppDelegate.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/16/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -42,11 +42,11 @@ @implementation TabBarAnimationAppDelegate #pragma mark - #pragma mark Application lifecycle -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. tabBarController.delegate = self; - + // Add the tab bar controller's view to the window and display. [self.window addSubview:tabBarController.view]; [self addTabBarArrow]; @@ -72,7 +72,7 @@ - (CGFloat) horizontalLocationFor:(NSUInteger)tabIndex CGFloat tabItemWidth = tabBarController.tabBar.frame.size.width / tabBarController.tabBar.items.count; // A half width is tabItemWidth divided by 2 minus half the width of the arrow CGFloat halfTabItemWidth = (tabItemWidth / 2.0) - (tabBarArrow.frame.size.width / 2.0); - + // The horizontal location is the index times the width plus a half width return (tabIndex * tabItemWidth) + halfTabItemWidth; } @@ -84,8 +84,8 @@ - (void)tabBarController:(UITabBarController *)theTabBarController didSelectView CGRect frame = tabBarArrow.frame; frame.origin.x = [self horizontalLocationFor:tabBarController.selectedIndex]; tabBarArrow.frame = frame; - [UIView commitAnimations]; - + [UIView commitAnimations]; + } - (void)applicationWillResignActive:(UIApplication *)application { @@ -98,7 +98,7 @@ - (void)applicationWillResignActive:(UIApplication *)application { - (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. + 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, called instead of applicationWillTerminate: when the user quits. */ } diff --git a/TabBarAnimation/main.m b/TabBarAnimation/main.m index f78ee39..458294f 100644 --- a/TabBarAnimation/main.m +++ b/TabBarAnimation/main.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/16/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/TransparentUIWebViews/Classes/RootViewController.h b/TransparentUIWebViews/Classes/RootViewController.h index 7080efe..59714aa 100644 --- a/TransparentUIWebViews/Classes/RootViewController.h +++ b/TransparentUIWebViews/Classes/RootViewController.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/3/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/TransparentUIWebViews/Classes/RootViewController.m b/TransparentUIWebViews/Classes/RootViewController.m index f744b0b..208b63c 100644 --- a/TransparentUIWebViews/Classes/RootViewController.m +++ b/TransparentUIWebViews/Classes/RootViewController.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/3/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -34,7 +34,7 @@ - (void)viewDidLoad [super viewDidLoad]; self.title = @"TransparentUIWebViews"; - + tableViewData = [[NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:@"Standard UIWebView", @"title", @"WebViewController", @"class", nil], [NSDictionary dictionaryWithObjectsAndKeys:@"Transparent UIWebView", @"title", @"TransparentWebViewController", @"class", nil], nil] retain]; } diff --git a/TransparentUIWebViews/Classes/TransparentUIWebViewsAppDelegate.h b/TransparentUIWebViews/Classes/TransparentUIWebViewsAppDelegate.h index 7a1a7d2..732584c 100644 --- a/TransparentUIWebViews/Classes/TransparentUIWebViewsAppDelegate.h +++ b/TransparentUIWebViews/Classes/TransparentUIWebViewsAppDelegate.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/3/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -28,7 +28,7 @@ #import @interface TransparentUIWebViewsAppDelegate : NSObject { - + UIWindow *window; UINavigationController *navigationController; } diff --git a/TransparentUIWebViews/Classes/TransparentUIWebViewsAppDelegate.m b/TransparentUIWebViews/Classes/TransparentUIWebViewsAppDelegate.m index f998a27..7297723 100644 --- a/TransparentUIWebViews/Classes/TransparentUIWebViewsAppDelegate.m +++ b/TransparentUIWebViews/Classes/TransparentUIWebViewsAppDelegate.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/3/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -38,10 +38,10 @@ @implementation TransparentUIWebViewsAppDelegate #pragma mark - #pragma mark Application lifecycle -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. - + // Add the navigation controller's view to the window and display. [self.window addSubview:navigationController.view]; [self.window makeKeyAndVisible]; @@ -60,7 +60,7 @@ - (void)applicationWillResignActive:(UIApplication *)application { - (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. + 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, called instead of applicationWillTerminate: when the user quits. */ } diff --git a/TransparentUIWebViews/Classes/TransparentWebViewController.h b/TransparentUIWebViews/Classes/TransparentWebViewController.h index 0e5638d..e9ab9aa 100644 --- a/TransparentUIWebViews/Classes/TransparentWebViewController.h +++ b/TransparentUIWebViews/Classes/TransparentWebViewController.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/3/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/TransparentUIWebViews/Classes/TransparentWebViewController.m b/TransparentUIWebViews/Classes/TransparentWebViewController.m index 91c39b3..16b4c82 100644 --- a/TransparentUIWebViews/Classes/TransparentWebViewController.m +++ b/TransparentUIWebViews/Classes/TransparentWebViewController.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/3/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/TransparentUIWebViews/Classes/WebViewController.h b/TransparentUIWebViews/Classes/WebViewController.h index d038c1c..f96ee07 100644 --- a/TransparentUIWebViews/Classes/WebViewController.h +++ b/TransparentUIWebViews/Classes/WebViewController.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/3/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/TransparentUIWebViews/Classes/WebViewController.m b/TransparentUIWebViews/Classes/WebViewController.m index 9940da9..a0d95c8 100644 --- a/TransparentUIWebViews/Classes/WebViewController.m +++ b/TransparentUIWebViews/Classes/WebViewController.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/3/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -33,9 +33,9 @@ @implementation WebViewController - (void)viewDidLoad { [super viewDidLoad]; - + [webView setBackgroundColor:[UIColor clearColor]]; - + [webView loadHTMLString:@"This is a standard UIWebView. Notice the gradient at the top and bottom as you scroll up and down." baseURL:nil]; } diff --git a/TransparentUIWebViews/main.m b/TransparentUIWebViews/main.m index 3a5e4ec..3df8917 100644 --- a/TransparentUIWebViews/main.m +++ b/TransparentUIWebViews/main.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/3/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/VerticalSwipeArticles/Classes/DetailViewController.h b/VerticalSwipeArticles/Classes/DetailViewController.h index aa34d58..9f4094d 100644 --- a/VerticalSwipeArticles/Classes/DetailViewController.h +++ b/VerticalSwipeArticles/Classes/DetailViewController.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/26/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -36,7 +36,7 @@ IBOutlet UIView* footerView; IBOutlet UIImageView* footerImageView; IBOutlet UILabel* footerLabel; - + VerticalSwipeScrollView* verticalSwipeScrollView; NSArray* appData; NSUInteger startIndex; diff --git a/VerticalSwipeArticles/Classes/DetailViewController.m b/VerticalSwipeArticles/Classes/DetailViewController.m index 24e92bd..43f0405 100644 --- a/VerticalSwipeArticles/Classes/DetailViewController.m +++ b/VerticalSwipeArticles/Classes/DetailViewController.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/26/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -86,18 +86,18 @@ -(void) footerUnloadedInScrollView:(VerticalSwipeScrollView*)scrollView -(UIView*) viewForScrollView:(VerticalSwipeScrollView*)scrollView atPage:(NSUInteger)page { UIWebView* webView = nil; - + if (page < scrollView.currentPageIndex) webView = [[previousPage retain] autorelease]; else if (page > scrollView.currentPageIndex) webView = [[nextPage retain] autorelease]; - + if (!webView) webView = [self createWebViewForIndex:page]; - + self.previousPage = page > 0 ? [self createWebViewForIndex:page-1] : nil; self.nextPage = (page == (appData.count-1)) ? nil : [self createWebViewForIndex:page+1]; - + self.navigationItem.title = [[[appData objectAtIndex:page] objectForKey:@"im:name"] objectForKey:@"label"]; if (page > 0) headerLabel.text = [[[appData objectAtIndex:page-1] objectForKey:@"im:name"] objectForKey:@"label"]; @@ -125,7 +125,7 @@ -(UIWebView*) createWebViewForIndex:(NSUInteger)index htmlString = [htmlString stringByReplacingOccurrencesOfString:@"" withString:[[[[appData objectAtIndex:index] objectForKey:@"im:image"] objectAtIndex:0] objectForKey:@"label"]]; htmlString = [htmlString stringByReplacingOccurrencesOfString:@"" withString:[[[appData objectAtIndex:index] objectForKey:@"summary"] objectForKey:@"label"]]; [webView loadHTMLString:htmlString baseURL:nil]; - + return webView; } diff --git a/VerticalSwipeArticles/Classes/RootViewController.h b/VerticalSwipeArticles/Classes/RootViewController.h index 97d0ad6..5612640 100644 --- a/VerticalSwipeArticles/Classes/RootViewController.h +++ b/VerticalSwipeArticles/Classes/RootViewController.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/26/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/VerticalSwipeArticles/Classes/RootViewController.m b/VerticalSwipeArticles/Classes/RootViewController.m index cca8303..0775fef 100644 --- a/VerticalSwipeArticles/Classes/RootViewController.m +++ b/VerticalSwipeArticles/Classes/RootViewController.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/26/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/VerticalSwipeArticles/Classes/VerticalSwipeArticlesAppDelegate.h b/VerticalSwipeArticles/Classes/VerticalSwipeArticlesAppDelegate.h index 9467a3e..2097e3c 100644 --- a/VerticalSwipeArticles/Classes/VerticalSwipeArticlesAppDelegate.h +++ b/VerticalSwipeArticles/Classes/VerticalSwipeArticlesAppDelegate.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/26/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/VerticalSwipeArticles/Classes/VerticalSwipeArticlesAppDelegate.m b/VerticalSwipeArticles/Classes/VerticalSwipeArticlesAppDelegate.m index 0e2d07f..ae59e40 100644 --- a/VerticalSwipeArticles/Classes/VerticalSwipeArticlesAppDelegate.m +++ b/VerticalSwipeArticles/Classes/VerticalSwipeArticlesAppDelegate.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/26/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -73,7 +73,7 @@ - (void)applicationWillResignActive:(UIApplication *)application { - (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. + 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, called instead of applicationWillTerminate: when the user quits. */ } @@ -137,7 +137,7 @@ - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)err - (void)connectionDidFinishLoading:(NSURLConnection *)connection { - NSString* topAppsString = [[[NSString alloc] initWithData:topAppsData encoding:NSUTF8StringEncoding] autorelease]; + NSString* topAppsString = [[[NSString alloc] initWithData:topAppsData encoding:NSUTF8StringEncoding] autorelease]; self.topAppsData = nil; @try { diff --git a/VerticalSwipeArticles/Classes/VerticalSwipeScrollView.h b/VerticalSwipeArticles/Classes/VerticalSwipeScrollView.h index afaae5f..5ab3f29 100644 --- a/VerticalSwipeArticles/Classes/VerticalSwipeScrollView.h +++ b/VerticalSwipeArticles/Classes/VerticalSwipeScrollView.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/26/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -42,10 +42,10 @@ IBOutlet UIView* headerView; IBOutlet UIView* footerView; - + BOOL _headerLoaded; BOOL _footerLoaded; - + NSUInteger currentPageIndex; UIView* currentPageView; } diff --git a/VerticalSwipeArticles/Classes/VerticalSwipeScrollView.m b/VerticalSwipeArticles/Classes/VerticalSwipeScrollView.m index 74a696d..920d5b3 100644 --- a/VerticalSwipeArticles/Classes/VerticalSwipeScrollView.m +++ b/VerticalSwipeArticles/Classes/VerticalSwipeScrollView.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/26/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -38,7 +38,7 @@ @implementation VerticalSwipeScrollView - (void)awakeFromNib { self.contentSize = self.frame.size; - + [self showCurrentPage]; } @@ -94,7 +94,7 @@ -(void) setHeaderView:(UIView*)newValue // Place the header above the scroll view headerView.frame = CGRectMake(0, -headerView.frame.size.height, headerView.frame.size.width, headerView.frame.size.height); [self addSubview:headerView]; - + // Hide the header if there is no previous page if (currentPageIndex <= 0) headerView.hidden = YES; @@ -115,7 +115,7 @@ -(void) setFooterView:(UIView*)newValue // Place the footer below the scroll view footerView.frame = CGRectMake(0, self.frame.size.height, footerView.frame.size.width, footerView.frame.size.height); [self addSubview:footerView]; - + // Hide the footer if there is no next page if (currentPageIndex == [externalDelegate pageCount]-1) footerView.hidden = YES; @@ -126,7 +126,7 @@ -(void) setFooterView:(UIView*)newValue -(void) setCurrentPageIndex:(NSUInteger)newValue { currentPageIndex = newValue; - + // Hide the header if there is no previous page headerView.hidden = currentPageIndex <= 0; // Hide the footer if there is no next page @@ -150,7 +150,7 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView { if ([externalDelegate respondsToSelector:@selector(scrollViewDidScroll:)]) [externalDelegate scrollViewDidScroll:scrollView]; - + // Everything we want to do is only applicable if the user is in the middle of dragging if (!scrollView.dragging) return; @@ -165,7 +165,7 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView { // The header is already loaded, nothing for us to do if (_headerLoaded) return; - + // The header has been loaded if ([externalDelegate respondsToSelector:@selector(headerLoadedInScrollView:)]) [externalDelegate performSelector:@selector(headerLoadedInScrollView:)]; @@ -175,7 +175,7 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView { // If the header isn't already loaded, nothing for us to do if (!_headerLoaded) return; - + // The header has been unloaded if ([externalDelegate respondsToSelector:@selector(headerUnloadedInScrollView:)]) [externalDelegate performSelector:@selector(headerUnloadedInScrollView:)]; @@ -186,13 +186,13 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView { // If the footer is hidden, then there is no next page and nothing for us to do if (footerView.hidden) return; - + // If the user has pulled up more than the height of the footer if (scrollView.contentOffset.y > footerView.frame.size.height) { // The footer is already loaded, nothing for us to do if (_footerLoaded) return; - + // The footer has been loaded if ([externalDelegate respondsToSelector:@selector(footerLoadedInScrollView:)]) [externalDelegate performSelector:@selector(footerLoadedInScrollView:)]; @@ -202,7 +202,7 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView { // If the footer isn't already loaded, nothing for us to do if (!_footerLoaded) return; - + // The footer has been unloaded if ([externalDelegate respondsToSelector:@selector(footerUnloadedInScrollView:)]) [externalDelegate performSelector:@selector(footerUnloadedInScrollView:)]; @@ -217,7 +217,7 @@ - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL { if ([externalDelegate respondsToSelector:@selector(scrollViewDidEndDragging:willDecelerate:)]) [externalDelegate scrollViewDidEndDragging:scrollView willDecelerate:decelerate]; - + // If the header is loaded, then the user wants to go to the previous page if (_headerLoaded) { @@ -227,7 +227,7 @@ - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL // Set its frame to the top of the scroll view previousPage.frame = CGRectMake(0, -(previousPage.frame.size.height + self.contentOffset.y), self.frame.size.width, self.frame.size.height); [self addSubview:previousPage]; - + // Start the page down animation [UIView beginAnimations:nil context:previousPage]; [UIView setAnimationDuration:0.2]; @@ -240,7 +240,7 @@ - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL // And we also animate the header view to animate off the bottom of the screen headerView.frame = CGRectMake(0, self.frame.size.height, headerView.frame.size.width, headerView.frame.size.height); [UIView commitAnimations]; - + // Decrement our current page currentPageIndex--; } @@ -252,7 +252,7 @@ - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL // Set its frame to the bottom of the scroll view nextPage.frame = CGRectMake(0, nextPage.frame.size.height + self.contentOffset.y, self.frame.size.width, self.frame.size.height); [self addSubview:nextPage]; - + // Start the page u animation [UIView beginAnimations:nil context:nextPage]; [UIView setAnimationDuration:0.2]; @@ -277,11 +277,11 @@ - (void)pageAnimationDidStop:(NSString *)animationID finished:(NSNumber *)finish { // Remove the old page [currentPageView removeFromSuperview]; - + // Set the previous/next page we just animated into view as the current page UIView* newPage = (UIView*)context; self.currentPageView = newPage; - + // After we've switched pages, reset the header/footer loaded states if (_footerLoaded && [externalDelegate respondsToSelector:@selector(footerUnloadedInScrollView:)]) [externalDelegate performSelector:@selector(footerUnloadedInScrollView:)]; @@ -290,11 +290,11 @@ - (void)pageAnimationDidStop:(NSString *)animationID finished:(NSNumber *)finish if (_headerLoaded && [externalDelegate respondsToSelector:@selector(headerUnloadedInScrollView:)]) [externalDelegate performSelector:@selector(headerUnloadedInScrollView:)]; _headerLoaded = NO; - + // Force the header and footer views to their default states headerView.frame = CGRectMake(0, -headerView.frame.size.height, headerView.frame.size.width, headerView.frame.size.height); footerView.frame = CGRectMake(0, self.frame.size.height, footerView.frame.size.width, footerView.frame.size.height); - + // Based on the current page index, hide/show the header and footer headerView.hidden = currentPageIndex <= 0; footerView.hidden = (currentPageIndex == [externalDelegate pageCount]-1); diff --git a/VerticalSwipeArticles/JSON/JSON.h b/VerticalSwipeArticles/JSON/JSON.h index db3c516..b34e27f 100755 --- a/VerticalSwipeArticles/JSON/JSON.h +++ b/VerticalSwipeArticles/JSON/JSON.h @@ -1,20 +1,20 @@ /* Copyright (C) 2009-2010 Stig Brautaset. All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -35,17 +35,17 @@ JSON. One standard object-based and a higher level api consisting of categories added to existing Objective-C classes. - This framework does its best to be as strict as possible, both in what it accepts and what it generates. For example, it does not support trailing commas in arrays or objects. Nor does it support embedded comments, or anything else not in the JSON specification. This is considered a feature. - + This framework does its best to be as strict as possible, both in what it accepts and what it generates. For example, it does not support trailing commas in arrays or objects. Nor does it support embedded comments, or anything else not in the JSON specification. This is considered a feature. + @section Links @li Project home page. - @li Online version of the API documentation. - + @li Online version of the API documentation. + */ -// This setting of 1 is best if you copy the source into your project. +// This setting of 1 is best if you copy the source into your project. // The build transforms the 1 to a 0 when building the framework and static lib. #if 1 diff --git a/VerticalSwipeArticles/JSON/NSObject+SBJSON.h b/VerticalSwipeArticles/JSON/NSObject+SBJSON.h index 8e9620e..cc3c1b6 100755 --- a/VerticalSwipeArticles/JSON/NSObject+SBJSON.h +++ b/VerticalSwipeArticles/JSON/NSObject+SBJSON.h @@ -1,20 +1,20 @@ /* Copyright (C) 2009 Stig Brautaset. All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -32,7 +32,7 @@ /** @brief Adds JSON generation to Foundation classes - + This is a category on NSObject that adds methods for returning JSON representations of standard objects to the objects themselves. This means you can call the -JSONRepresentation method on an NSArray object and it'll do what you want. diff --git a/VerticalSwipeArticles/JSON/NSObject+SBJSON.m b/VerticalSwipeArticles/JSON/NSObject+SBJSON.m index 30570b5..dc84b68 100755 --- a/VerticalSwipeArticles/JSON/NSObject+SBJSON.m +++ b/VerticalSwipeArticles/JSON/NSObject+SBJSON.m @@ -1,20 +1,20 @@ /* Copyright (C) 2009 Stig Brautaset. All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -33,7 +33,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE @implementation NSObject (NSObject_SBJSON) - (NSString *)JSONRepresentation { - SBJsonWriter *jsonWriter = [SBJsonWriter new]; + SBJsonWriter *jsonWriter = [SBJsonWriter new]; NSString *json = [jsonWriter stringWithObject:self]; if (!json) NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]); diff --git a/VerticalSwipeArticles/JSON/NSString+SBJSON.h b/VerticalSwipeArticles/JSON/NSString+SBJSON.h index 029aa30..55d6591 100755 --- a/VerticalSwipeArticles/JSON/NSString+SBJSON.h +++ b/VerticalSwipeArticles/JSON/NSString+SBJSON.h @@ -1,20 +1,20 @@ /* Copyright (C) 2009 Stig Brautaset. All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -31,14 +31,14 @@ /** @brief Adds JSON parsing methods to NSString - + This is a category on NSString that adds methods for parsing the target string. */ @interface NSString (NSString_SBJSON) /** @brief Returns the NSDictionary or NSArray represented by the current string's JSON representation. - + Returns the dictionary or array represented in the receiver, or nil on error. Returns the NSDictionary or NSArray represented by the current string's JSON representation. diff --git a/VerticalSwipeArticles/JSON/NSString+SBJSON.m b/VerticalSwipeArticles/JSON/NSString+SBJSON.m index bb132e1..230531c 100755 --- a/VerticalSwipeArticles/JSON/NSString+SBJSON.m +++ b/VerticalSwipeArticles/JSON/NSString+SBJSON.m @@ -1,20 +1,20 @@ /* Copyright (C) 2007-2009 Stig Brautaset. All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE diff --git a/VerticalSwipeArticles/JSON/SBJsonBase.h b/VerticalSwipeArticles/JSON/SBJsonBase.h index 7b10844..1403c45 100755 --- a/VerticalSwipeArticles/JSON/SBJsonBase.h +++ b/VerticalSwipeArticles/JSON/SBJsonBase.h @@ -1,20 +1,20 @@ /* Copyright (C) 2009 Stig Brautaset. All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -61,7 +61,7 @@ enum { /** @brief The maximum recursing depth. - + Defaults to 512. If the input is nested deeper than this the input will be deemed to be malicious and the parser returns nil, signalling an error. ("Nested too deep".) You can turn off this security feature by setting the maxDepth value to 0. @@ -70,7 +70,7 @@ enum { /** @brief Return an error trace, or nil if there was no errors. - + Note that this method returns the trace of the last method that failed. You need to check the return value of the call you're making to figure out if the call actually failed, before you know call this method. diff --git a/VerticalSwipeArticles/JSON/SBJsonBase.m b/VerticalSwipeArticles/JSON/SBJsonBase.m index 6684325..d7a1393 100755 --- a/VerticalSwipeArticles/JSON/SBJsonBase.m +++ b/VerticalSwipeArticles/JSON/SBJsonBase.m @@ -1,20 +1,20 @@ /* Copyright (C) 2009 Stig Brautaset. All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -53,14 +53,14 @@ - (void)addErrorWithCode:(NSUInteger)code description:(NSString*)str { if (!errorTrace) { errorTrace = [NSMutableArray new]; userInfo = [NSDictionary dictionaryWithObject:str forKey:NSLocalizedDescriptionKey]; - + } else { userInfo = [NSDictionary dictionaryWithObjectsAndKeys: str, NSLocalizedDescriptionKey, [errorTrace lastObject], NSUnderlyingErrorKey, nil]; } - + NSError *error = [NSError errorWithDomain:SBJSONErrorDomain code:code userInfo:userInfo]; [self willChangeValueForKey:@"errorTrace"]; diff --git a/VerticalSwipeArticles/JSON/SBJsonParser.h b/VerticalSwipeArticles/JSON/SBJsonParser.h index feaccd8..1e4e0d9 100755 --- a/VerticalSwipeArticles/JSON/SBJsonParser.h +++ b/VerticalSwipeArticles/JSON/SBJsonParser.h @@ -1,20 +1,20 @@ /* Copyright (C) 2009 Stig Brautaset. All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -32,47 +32,47 @@ /** @brief The JSON parser class. - + JSON is mapped to Objective-C types in the following way: - + @li Null -> NSNull @li String -> NSMutableString @li Array -> NSMutableArray @li Object -> NSMutableDictionary @li Boolean -> NSNumber (initialised with -initWithBool:) @li Number -> (NSNumber | NSDecimalNumber) - + Since Objective-C doesn't have a dedicated class for boolean values, these turns into NSNumber - instances. These are initialised with the -initWithBool: method, and + instances. These are initialised with the -initWithBool: method, and round-trip back to JSON properly. (They won't silently suddenly become 0 or 1; they'll be represented as 'true' and 'false' again.) - + As an optimisation short JSON integers turn into NSNumber instances, while complex ones turn into NSDecimalNumber instances. We can thus avoid any loss of precision as JSON allows ridiculously large numbers. - + */ @interface SBJsonParser : SBJsonBase { - + @private const char *c; } /** @brief Return the object represented by the given string - + Returns the object represented by the passed-in string or nil on error. The returned object can be a string, number, boolean, null, array or dictionary. - + @param repr the json string to parse */ - (id)objectWithString:(NSString *)repr; /** @brief Return the object represented by the given string - + Returns the object represented by the passed-in string or nil on error. The returned object can be a string, number, boolean, null, array or dictionary. - + @param jsonText the json string to parse @param error pointer to an NSError object to populate on error */ diff --git a/VerticalSwipeArticles/JSON/SBJsonParser.m b/VerticalSwipeArticles/JSON/SBJsonParser.m index 222ef70..f008cad 100755 --- a/VerticalSwipeArticles/JSON/SBJsonParser.m +++ b/VerticalSwipeArticles/JSON/SBJsonParser.m @@ -1,20 +1,20 @@ /* Copyright (C) 2009,2010 Stig Brautaset. All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -64,39 +64,39 @@ + (void)initialize { ctrl[1] = '\\'; for (int i = 1; i < 0x20; i++) ctrl[i+1] = i; - ctrl[0x21] = 0; + ctrl[0x21] = 0; } - (id)objectWithString:(NSString *)repr { [self clearErrorTrace]; - + if (!repr) { [self addErrorWithCode:EINPUT description:@"Input was 'nil'"]; return nil; } - + depth = 0; c = [repr UTF8String]; - + id o; if (![self scanValue:&o]) { return nil; } - + // We found some valid JSON. But did it also contain something else? if (![self scanIsAtEnd]) { [self addErrorWithCode:ETRAILGARBAGE description:@"Garbage after JSON"]; return nil; } - + NSAssert1(o, @"Should have a valid object from %@", repr); - + // Check that the object we've found is a valid JSON container. if (![o isKindOfClass:[NSDictionary class]] && ![o isKindOfClass:[NSArray class]]) { [self addErrorWithCode:EFRAGMENT description:@"Valid fragment, but not JSON"]; return nil; } - + return o; } @@ -104,7 +104,7 @@ - (id)objectWithString:(NSString*)repr error:(NSError**)error { id tmp = [self objectWithString:repr]; if (tmp) return tmp; - + if (error) *error = [self.errorTrace lastObject]; return nil; @@ -117,7 +117,7 @@ - (id)objectWithString:(NSString*)repr error:(NSError**)error { - (BOOL)scanValue:(NSObject **)o { skipWhitespace(c); - + switch (*c++) { case '{': return [self scanRestOfDictionary:(NSMutableDictionary **)o]; @@ -155,7 +155,7 @@ - (BOOL)scanValue:(NSObject **)o return NO; break; } - + NSAssert(0, @"Should never get here"); return NO; } @@ -197,25 +197,25 @@ - (BOOL)scanRestOfArray:(NSMutableArray **)o { [self addErrorWithCode:EDEPTH description: @"Nested too deep"]; return NO; } - + *o = [NSMutableArray arrayWithCapacity:8]; - + for (; *c ;) { id v; - + skipWhitespace(c); if (*c == ']' && c++) { depth--; return YES; } - + if (![self scanValue:&v]) { [self addErrorWithCode:EPARSE description:@"Expected value while parsing array"]; return NO; } - + [*o addObject:v]; - + skipWhitespace(c); if (*c == ',' && c++) { skipWhitespace(c); @@ -223,51 +223,51 @@ - (BOOL)scanRestOfArray:(NSMutableArray **)o { [self addErrorWithCode:ETRAILCOMMA description: @"Trailing comma disallowed in array"]; return NO; } - } + } } - + [self addErrorWithCode:EEOF description: @"End of input while parsing array"]; return NO; } -- (BOOL)scanRestOfDictionary:(NSMutableDictionary **)o +- (BOOL)scanRestOfDictionary:(NSMutableDictionary **)o { if (maxDepth && ++depth > maxDepth) { [self addErrorWithCode:EDEPTH description: @"Nested too deep"]; return NO; } - + *o = [NSMutableDictionary dictionaryWithCapacity:7]; - + for (; *c ;) { id k, v; - + skipWhitespace(c); if (*c == '}' && c++) { depth--; return YES; - } - + } + if (!(*c == '\"' && c++ && [self scanRestOfString:&k])) { [self addErrorWithCode:EPARSE description: @"Object key string expected"]; return NO; } - + skipWhitespace(c); if (*c != ':') { [self addErrorWithCode:EPARSE description: @"Expected ':' separating key and value"]; return NO; } - + c++; if (![self scanValue:&v]) { NSString *string = [NSString stringWithFormat:@"Object value expected for key: %@", k]; [self addErrorWithCode:EPARSE description: string]; return NO; } - + [*o setObject:v forKey:k]; - + skipWhitespace(c); if (*c == ',' && c++) { skipWhitespace(c); @@ -275,14 +275,14 @@ - (BOOL)scanRestOfDictionary:(NSMutableDictionary **)o [self addErrorWithCode:ETRAILCOMMA description: @"Trailing comma disallowed in object"]; return NO; } - } + } } - + [self addErrorWithCode:EEOF description: @"End of input while parsing object"]; return NO; } -- (BOOL)scanRestOfString:(NSMutableString **)o +- (BOOL)scanRestOfString:(NSMutableString **)o { // if the string has no control characters in it, return it in one go, without any temporary allocations. size_t len = strcspn(c, ctrl); @@ -292,14 +292,14 @@ - (BOOL)scanRestOfString:(NSMutableString **)o c += len + 1; return YES; } - + *o = [NSMutableString stringWithCapacity:16]; do { - // First see if there's a portion we can grab in one go. + // First see if there's a portion we can grab in one go. // Doing this caused a massive speedup on the long string. len = strcspn(c, ctrl); if (len) { - // check for + // check for id t = [[NSString alloc] initWithBytesNoCopy:(char*)c length:len encoding:NSUTF8StringEncoding @@ -310,11 +310,11 @@ - (BOOL)scanRestOfString:(NSMutableString **)o c += len; } } - + if (*c == '"') { c++; return YES; - + } else if (*c == '\\') { unichar uc = *++c; switch (uc) { @@ -322,13 +322,13 @@ - (BOOL)scanRestOfString:(NSMutableString **)o case '/': case '"': break; - + case 'b': uc = '\b'; break; case 'n': uc = '\n'; break; case 'r': uc = '\r'; break; case 't': uc = '\t'; break; - case 'f': uc = '\f'; break; - + case 'f': uc = '\f'; break; + case 'u': c++; if (![self scanUnicodeChar:&uc]) { @@ -344,16 +344,16 @@ - (BOOL)scanRestOfString:(NSMutableString **)o } CFStringAppendCharacters((CFMutableStringRef)*o, &uc, 1); c++; - + } else if (*c < 0x20) { [self addErrorWithCode:ECTRL description: [NSString stringWithFormat:@"Unescaped control character '0x%x'", *c]]; return NO; - + } else { NSLog(@"should not be able to get here"); } } while (*c); - + [self addErrorWithCode:EEOF description:@"Unexpected EOF while parsing string"]; return NO; } @@ -361,33 +361,33 @@ - (BOOL)scanRestOfString:(NSMutableString **)o - (BOOL)scanUnicodeChar:(unichar *)x { unichar hi, lo; - + if (![self scanHexQuad:&hi]) { [self addErrorWithCode:EUNICODE description: @"Missing hex quad"]; - return NO; + return NO; } - + if (hi >= 0xd800) { // high surrogate char? if (hi < 0xdc00) { // yes - expect a low char - + if (!(*c == '\\' && ++c && *c == 'u' && ++c && [self scanHexQuad:&lo])) { [self addErrorWithCode:EUNICODE description: @"Missing low character in surrogate pair"]; return NO; } - + if (lo < 0xdc00 || lo >= 0xdfff) { [self addErrorWithCode:EUNICODE description:@"Invalid low surrogate char"]; return NO; } - + hi = (hi - 0xd800) * 0x400 + (lo - 0xdc00) + 0x10000; - + } else if (hi < 0xe000) { [self addErrorWithCode:EUNICODE description:@"Invalid high character in surrogate pair"]; return NO; } } - + *x = hi; return YES; } @@ -415,67 +415,67 @@ - (BOOL)scanHexQuad:(unichar *)x - (BOOL)scanNumber:(NSNumber **)o { BOOL simple = YES; - + const char *ns = c; - + // The logic to test for validity of the number formatting is relicensed // from JSON::XS with permission from its author Marc Lehmann. // (Available at the CPAN: http://search.cpan.org/dist/JSON-XS/ .) - + if ('-' == *c) c++; - - if ('0' == *c && c++) { + + if ('0' == *c && c++) { if (isdigit(*c)) { [self addErrorWithCode:EPARSENUM description: @"Leading 0 disallowed in number"]; return NO; } - + } else if (!isdigit(*c) && c != ns) { [self addErrorWithCode:EPARSENUM description: @"No digits after initial minus"]; return NO; - + } else { skipDigits(c); } - + // Fractional part if ('.' == *c && c++) { simple = NO; if (!isdigit(*c)) { [self addErrorWithCode:EPARSENUM description: @"No digits after decimal point"]; return NO; - } + } skipDigits(c); } - + // Exponential part if ('e' == *c || 'E' == *c) { simple = NO; c++; - + if ('-' == *c || '+' == *c) c++; - + if (!isdigit(*c)) { [self addErrorWithCode:EPARSENUM description: @"No digits after exponent"]; return NO; } skipDigits(c); } - + // If we are only reading integers, don't go through the expense of creating an NSDecimal. // This ends up being a very large perf win. if (simple) { BOOL negate = NO; long long val = 0; const char *d = ns; - + if (*d == '-') { negate = YES; d++; } - + while (isdigit(*d)) { val *= 10; if (val < 0) @@ -485,14 +485,14 @@ - (BOOL)scanNumber:(NSNumber **)o goto longlong_overflow; d++; } - + *o = [NSNumber numberWithLongLong:negate ? -val : val]; return YES; - + } else { // jumped to by simple branch, if an overflow occured longlong_overflow:; - + id str = [[NSString alloc] initWithBytesNoCopy:(char*)ns length:c - ns encoding:NSUTF8StringEncoding @@ -500,7 +500,7 @@ - (BOOL)scanNumber:(NSNumber **)o [str autorelease]; if (str && (*o = [NSDecimalNumber decimalNumberWithString:str])) return YES; - + [self addErrorWithCode:EPARSENUM description: @"Failed creating decimal instance"]; return NO; } diff --git a/VerticalSwipeArticles/JSON/SBJsonWriter.h b/VerticalSwipeArticles/JSON/SBJsonWriter.h index ae1a597..69eb603 100755 --- a/VerticalSwipeArticles/JSON/SBJsonWriter.h +++ b/VerticalSwipeArticles/JSON/SBJsonWriter.h @@ -1,20 +1,20 @@ /* Copyright (C) 2009 Stig Brautaset. All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -32,25 +32,25 @@ /** @brief The JSON writer class. - + Objective-C types are mapped to JSON types in the following way: - + @li NSNull -> Null @li NSString -> String @li NSArray -> Array @li NSDictionary -> Object @li NSNumber (-initWithBool:) -> Boolean @li NSNumber -> Number - + In JSON the keys of an object must be strings. NSDictionary keys need not be, but attempting to convert an NSDictionary with non-string keys into JSON will throw an exception. - + NSNumber instances created with the +initWithBool: method are converted into the JSON boolean "true" and "false" values, and vice versa. Any other NSNumber instances are converted to a JSON number the way you would expect. - + */ @interface SBJsonWriter : SBJsonBase { @@ -60,7 +60,7 @@ /** @brief Whether we are generating human-readable (multiline) JSON. - + Set whether or not to generate human-readable JSON. The default is NO, which produces JSON without any whitespace. (Except inside strings.) If set to YES, generates human-readable JSON with linebreaks after each array value and dictionary key/value pair, indented two @@ -70,7 +70,7 @@ /** @brief Whether or not to sort the dictionary keys in the output. - + If this is set to YES, the dictionary keys in the JSON output will be in sorted order. (This is useful if you need to compare two structures, for example.) The default is NO. */ @@ -78,24 +78,24 @@ /** @brief Return JSON representation (or fragment) for the given object. - + Returns a string containing JSON representation of the passed in value, or nil on error. If nil is returned and @p error is not NULL, @p *error can be interrogated to find the cause of the error. - + @param value any instance that can be represented as a JSON fragment - + */ - (NSString*)stringWithObject:(id)value; /** @brief Return JSON representation (or fragment) for the given object. - + Returns a string containing JSON representation of the passed in value, or nil on error. If nil is returned and @p error is not NULL, @p *error can be interrogated to find the cause of the error. - + @param value any instance that can be represented as a JSON fragment @param error pointer to object to be populated with NSError on failure - + */- (NSString*)stringWithObject:(id)value error:(NSError**)error; @@ -104,12 +104,12 @@ /** @brief Allows generation of JSON for otherwise unsupported classes. - + If you have a custom class that you want to create a JSON representation for you can implement this method in your class. It should return a representation of your object defined in terms of objects that can be translated into JSON. For example, a Person object might implement it like this: - + @code - (id)proxyForJson { return [NSDictionary dictionaryWithObjectsAndKeys: @@ -119,7 +119,7 @@ nil]; } @endcode - + */ @interface NSObject (SBProxyForJson) - (id)proxyForJson; diff --git a/VerticalSwipeArticles/JSON/SBJsonWriter.m b/VerticalSwipeArticles/JSON/SBJsonWriter.m index 83e8a20..5968f77 100755 --- a/VerticalSwipeArticles/JSON/SBJsonWriter.m +++ b/VerticalSwipeArticles/JSON/SBJsonWriter.m @@ -1,20 +1,20 @@ /* Copyright (C) 2009 Stig Brautaset. All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -54,20 +54,20 @@ + (void)initialize { - (NSString*)stringWithObject:(id)value { [self clearErrorTrace]; - + if ([value isKindOfClass:[NSDictionary class]] || [value isKindOfClass:[NSArray class]]) { depth = 0; NSMutableString *json = [NSMutableString stringWithCapacity:128]; if ([self appendValue:value into:json]) return json; } - + if ([value respondsToSelector:@selector(proxyForJson)]) { NSString *tmp = [self stringWithObject:[value proxyForJson]]; if (tmp) return tmp; } - + [self addErrorWithCode:EFRAGMENT description:@"Not valid type for JSON"]; return nil; } @@ -76,7 +76,7 @@ - (NSString*)stringWithObject:(id)value error:(NSError**)error { NSString *tmp = [self stringWithObject:value]; if (tmp) return tmp; - + if (error) *error = [self.errorTrace lastObject]; return nil; @@ -90,15 +90,15 @@ - (BOOL)appendValue:(id)fragment into:(NSMutableString*)json { if ([fragment isKindOfClass:[NSDictionary class]]) { if (![self appendDictionary:fragment into:json]) return NO; - + } else if ([fragment isKindOfClass:[NSArray class]]) { if (![self appendArray:fragment into:json]) return NO; - + } else if ([fragment isKindOfClass:[NSString class]]) { if (![self appendString:fragment into:json]) return NO; - + } else if ([fragment isKindOfClass:[NSNumber class]]) { if ('c' == *[fragment objCType]) { [json appendString:[fragment boolValue] ? @"true" : @"false"]; @@ -117,7 +117,7 @@ - (BOOL)appendValue:(id)fragment into:(NSMutableString*)json { [json appendString:@"null"]; } else if ([fragment respondsToSelector:@selector(proxyForJson)]) { [self appendValue:[fragment proxyForJson] into:json]; - + } else { [self addErrorWithCode:EUNSUPPORTED description:[NSString stringWithFormat:@"JSON serialisation not supported for %@", [fragment class]]]; return NO; @@ -131,22 +131,22 @@ - (BOOL)appendArray:(NSArray*)fragment into:(NSMutableString*)json { return NO; } [json appendString:@"["]; - - BOOL addComma = NO; + + BOOL addComma = NO; for (id value in fragment) { if (addComma) [json appendString:@","]; else addComma = YES; - + if ([self humanReadable]) [json appendString:[self indent]]; - + if (![self appendValue:value into:json]) { return NO; } } - + depth--; if ([self humanReadable] && [fragment count]) [json appendString:[self indent]]; @@ -160,53 +160,53 @@ - (BOOL)appendDictionary:(NSDictionary*)fragment into:(NSMutableString*)json { return NO; } [json appendString:@"{"]; - + NSString *colon = [self humanReadable] ? @" : " : @":"; BOOL addComma = NO; NSArray *keys = [fragment allKeys]; if (self.sortKeys) keys = [keys sortedArrayUsingSelector:@selector(compare:)]; - + for (id value in keys) { if (addComma) [json appendString:@","]; else addComma = YES; - + if ([self humanReadable]) [json appendString:[self indent]]; - + if (![value isKindOfClass:[NSString class]]) { [self addErrorWithCode:EUNSUPPORTED description: @"JSON object key must be string"]; return NO; } - + if (![self appendString:value into:json]) return NO; - + [json appendString:colon]; if (![self appendValue:[fragment objectForKey:value] into:json]) { [self addErrorWithCode:EUNSUPPORTED description:[NSString stringWithFormat:@"Unsupported value for key %@ in object", value]]; return NO; } } - + depth--; if ([self humanReadable] && [fragment count]) [json appendString:[self indent]]; [json appendString:@"}"]; - return YES; + return YES; } - (BOOL)appendString:(NSString*)fragment into:(NSMutableString*)json { - + [json appendString:@"\""]; - + NSRange esc = [fragment rangeOfCharacterFromSet:kEscapeChars]; if ( !esc.length ) { // No special chars -- can just add the raw string: [json appendString:fragment]; - + } else { NSUInteger length = [fragment length]; for (NSUInteger i = 0; i < length; i++) { @@ -219,18 +219,18 @@ - (BOOL)appendString:(NSString*)fragment into:(NSMutableString*)json { case '\r': [json appendString:@"\\r"]; break; case '\b': [json appendString:@"\\b"]; break; case '\f': [json appendString:@"\\f"]; break; - default: + default: if (uc < 0x20) { [json appendFormat:@"\\u%04x", uc]; } else { CFStringAppendCharacters((CFMutableStringRef)json, &uc, 1); } break; - + } } } - + [json appendString:@"\""]; return YES; } diff --git a/VerticalSwipeArticles/main.m b/VerticalSwipeArticles/main.m index 89bd7f7..10eb5f2 100644 --- a/VerticalSwipeArticles/main.m +++ b/VerticalSwipeArticles/main.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/26/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -28,7 +28,7 @@ #import int main(int argc, char *argv[]) { - + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, nil, nil); [pool release]; diff --git a/WoodUINavigation/Classes/CustomSegmentedControl.h b/WoodUINavigation/Classes/CustomSegmentedControl.h index 0108775..0a8d404 100644 --- a/WoodUINavigation/Classes/CustomSegmentedControl.h +++ b/WoodUINavigation/Classes/CustomSegmentedControl.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/13/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/WoodUINavigation/Classes/CustomSegmentedControl.m b/WoodUINavigation/Classes/CustomSegmentedControl.m index 936973a..cacab51 100644 --- a/WoodUINavigation/Classes/CustomSegmentedControl.m +++ b/WoodUINavigation/Classes/CustomSegmentedControl.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/13/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -36,7 +36,7 @@ - (id) initWithSegmentCount:(NSUInteger)segmentCount segmentsize:(CGSize)segment { // The tag allows callers withe multiple controls to distinguish between them self.tag = objectTag; - + // Set the delegate delegate = customSegmentedControlDelegate; @@ -48,7 +48,7 @@ - (id) initWithSegmentCount:(NSUInteger)segmentCount segmentsize:(CGSize)segment // horizontalOffset tracks the proper x value as we add buttons as subviews CGFloat horizontalOffset = 0; - + // Iterate through each segment for (NSUInteger i = 0 ; i < segmentCount ; i++) { @@ -61,7 +61,7 @@ - (id) initWithSegmentCount:(NSUInteger)segmentCount segmentsize:(CGSize)segment [button addTarget:self action:@selector(otherTouchesAction:) forControlEvents:UIControlEventTouchUpOutside]; [button addTarget:self action:@selector(otherTouchesAction:) forControlEvents:UIControlEventTouchDragOutside]; [button addTarget:self action:@selector(otherTouchesAction:) forControlEvents:UIControlEventTouchDragInside]; - + // Add the button to our buttons array [buttons addObject:button]; @@ -107,7 +107,7 @@ -(void) dimAllButtonsExcept:(UIButton*)selectedButton - (void)touchDownAction:(UIButton*)button { [self dimAllButtonsExcept:button]; - + if ([delegate respondsToSelector:@selector(touchDownAtSegmentIndex:)]) [delegate touchDownAtSegmentIndex:[buttons indexOfObject:button]]; } diff --git a/WoodUINavigation/Classes/RootViewController.h b/WoodUINavigation/Classes/RootViewController.h index 9648033..6c383f9 100644 --- a/WoodUINavigation/Classes/RootViewController.h +++ b/WoodUINavigation/Classes/RootViewController.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/13/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 diff --git a/WoodUINavigation/Classes/RootViewController.m b/WoodUINavigation/Classes/RootViewController.m index b0aec8b..210f48f 100644 --- a/WoodUINavigation/Classes/RootViewController.m +++ b/WoodUINavigation/Classes/RootViewController.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/13/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -85,7 +85,7 @@ - (void) touchDownAtSegmentIndex:(NSUInteger)segmentIndex [[[[UIAlertView alloc] initWithTitle:[segmentControlTitles objectAtIndex:segmentIndex] message:nil delegate:nil - cancelButtonTitle:nil + cancelButtonTitle:nil otherButtonTitles:NSLocalizedString(@"OK", nil), nil] autorelease] show]; } @@ -128,7 +128,7 @@ -(UIButton*)woodButtonWithText:(NSString*)buttonText stretch:(CapLocation)locati else { buttonWidth = BUTTON_SEGMENT_WIDTH; - + buttonImage = [self image:[[UIImage imageNamed:@"nav-button.png"] stretchableImageWithLeftCapWidth:CAP_WIDTH topCapHeight:0.0] withCap:location capWidth:CAP_WIDTH buttonWidth:buttonWidth]; buttonPressedImage = [self image:[[UIImage imageNamed:@"nav-button-press.png"] stretchableImageWithLeftCapWidth:CAP_WIDTH topCapHeight:0.0] withCap:location capWidth:CAP_WIDTH buttonWidth:buttonWidth]; } @@ -155,7 +155,7 @@ - (void)storeAction:(id)sender [[[[UIAlertView alloc] initWithTitle:@"Store" message:nil delegate:nil - cancelButtonTitle:nil + cancelButtonTitle:nil otherButtonTitles:NSLocalizedString(@"OK", nil), nil] autorelease] show]; } @@ -164,7 +164,7 @@ - (void)editAction:(id)sender [[[[UIAlertView alloc] initWithTitle:@"Edit" message:nil delegate:nil - cancelButtonTitle:nil + cancelButtonTitle:nil otherButtonTitles:NSLocalizedString(@"OK", nil), nil] autorelease] show]; } diff --git a/WoodUINavigation/Classes/WoodUINavigationAppDelegate.h b/WoodUINavigation/Classes/WoodUINavigationAppDelegate.h index 6290824..f1305c8 100644 --- a/WoodUINavigation/Classes/WoodUINavigationAppDelegate.h +++ b/WoodUINavigation/Classes/WoodUINavigationAppDelegate.h @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/13/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -28,7 +28,7 @@ #import @interface WoodUINavigationAppDelegate : NSObject { - + UIWindow *window; UINavigationController *navigationController; } diff --git a/WoodUINavigation/Classes/WoodUINavigationAppDelegate.m b/WoodUINavigation/Classes/WoodUINavigationAppDelegate.m index 87a2f82..2de1ad8 100644 --- a/WoodUINavigation/Classes/WoodUINavigationAppDelegate.m +++ b/WoodUINavigation/Classes/WoodUINavigationAppDelegate.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/13/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -39,13 +39,13 @@ @implementation WoodUINavigationAppDelegate #pragma mark Application lifecycle - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - + // Override point for customization after application launch. UIImageView* imageView = [[[UIImageView alloc] initWithFrame:navigationController.navigationBar.frame] autorelease]; imageView.contentMode = UIViewContentModeLeft; imageView.image = [UIImage imageNamed:@"NavBar-iPhone.png"]; [navigationController.navigationBar insertSubview:imageView atIndex:0]; - + // Add the navigation controller's view to the window and display. [self.window addSubview:navigationController.view]; [self.window makeKeyAndVisible]; @@ -64,7 +64,7 @@ - (void)applicationWillResignActive:(UIApplication *)application { - (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. + 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, called instead of applicationWillTerminate: when the user quits. */ } diff --git a/WoodUINavigation/main.m b/WoodUINavigation/main.m index 6369611..20b1272 100644 --- a/WoodUINavigation/main.m +++ b/WoodUINavigation/main.m @@ -5,17 +5,17 @@ // Created by Peter Boctor on 12/13/10. // // Copyright (c) 2011 Peter Boctor -// +// // 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 @@ -28,7 +28,7 @@ #import int main(int argc, char *argv[]) { - + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, nil, nil); [pool release]; diff --git a/WordPressReimagined/Classes/BaseLoadingViewController.m b/WordPressReimagined/Classes/BaseLoadingViewController.m index 6718695..5704d80 100644 --- a/WordPressReimagined/Classes/BaseLoadingViewController.m +++ b/WordPressReimagined/Classes/BaseLoadingViewController.m @@ -43,7 +43,7 @@ - (void)viewDidLoad - (void) viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - + self.loadingView.center = [self centerForLoading]; } diff --git a/WordPressReimagined/Classes/BaseTableViewController.m b/WordPressReimagined/Classes/BaseTableViewController.m index 92e553b..444179b 100644 --- a/WordPressReimagined/Classes/BaseTableViewController.m +++ b/WordPressReimagined/Classes/BaseTableViewController.m @@ -45,13 +45,13 @@ @implementation BaseTableViewController @synthesize collection, collectionConnection, collectionData; @synthesize nextPage; -- (id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil +- (id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { - if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) + if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { self.nextPage = 1; } - + return self; } @@ -170,7 +170,7 @@ - (void) parseJSONResult modelObject.uniqueIdentifierKey = @"url"; modelObject.imageURLKey = @"image"; modelObject.verticalOffsetKey = @"y_offset"; - + [modelObjectResults addObject:modelObject]; NSNumber* nextPageObject = [modelObject objectForKey:@"next_page"]; @@ -234,7 +234,7 @@ - (UITableViewCell *)tableView:(UITableView *)theTableView cellForRowAtIndexPath } moreCell.loadingLabel.textColor = [UIColor darkGrayColor]; moreCell.loading.hidden = YES; - + return moreCell; } diff --git a/WordPressReimagined/Classes/CustomTabBar.m b/WordPressReimagined/Classes/CustomTabBar.m index 634c7d3..ce36aad 100644 --- a/WordPressReimagined/Classes/CustomTabBar.m +++ b/WordPressReimagined/Classes/CustomTabBar.m @@ -47,10 +47,10 @@ - (id) initWithItemCount:(NSUInteger)itemCount itemSize:(CGSize)itemSize tag:(NS { // The tag allows callers withe multiple controls to distinguish between them self.tag = objectTag; - + // Set the delegate delegate = customTabBarDelegate; - + // Add the background image UIImage* backgroundImage = [delegate backgroundImage]; UIImageView* backgroundImageView = [[[UIImageView alloc] initWithImage:backgroundImage] autorelease]; @@ -65,7 +65,7 @@ - (id) initWithItemCount:(NSUInteger)itemCount itemSize:(CGSize)itemSize tag:(NS // horizontalOffset tracks the proper x value as we add buttons as subviews CGFloat horizontalOffset = 0; - + // Iterate through each item for (NSUInteger i = 0 ; i < itemCount ; i++) { @@ -78,7 +78,7 @@ - (id) initWithItemCount:(NSUInteger)itemCount itemSize:(CGSize)itemSize tag:(NS [button addTarget:self action:@selector(otherTouchesAction:) forControlEvents:UIControlEventTouchUpOutside]; [button addTarget:self action:@selector(otherTouchesAction:) forControlEvents:UIControlEventTouchDragOutside]; [button addTarget:self action:@selector(otherTouchesAction:) forControlEvents:UIControlEventTouchDragInside]; - + // Add the button to our buttons array [buttons addObject:button]; @@ -87,7 +87,7 @@ - (id) initWithItemCount:(NSUInteger)itemCount itemSize:(CGSize)itemSize tag:(NS // Add the button as our subview [self addSubview:button]; - + // Advance the horizontal offset horizontalOffset = horizontalOffset + itemSize.width; } @@ -132,7 +132,7 @@ -(void) dimAllButtonsExcept:(UIButton*)selectedButton - (void)touchDownAction:(UIButton*)button { [self dimAllButtonsExcept:button]; - + if ([delegate respondsToSelector:@selector(touchDownAtItemAtIndex:)]) [delegate touchDownAtItemAtIndex:[buttons indexOfObject:button]]; } @@ -154,7 +154,7 @@ - (void) selectItemAtIndex:(NSInteger)index { // Get the right button to select UIButton* button = [buttons objectAtIndex:index]; - + [self dimAllButtonsExcept:button]; } @@ -163,19 +163,19 @@ - (void) glowItemAtIndex:(NSInteger)index { // Get the right button. We'll use to calculate where to put the glow UIButton* button = [buttons objectAtIndex:index]; - + // Ask the delegate for the glow image UIImage* glowImage = [delegate glowImage]; - + // Create the image view that will hold the glow image UIImageView* glowImageView = [[[UIImageView alloc] initWithImage:glowImage] autorelease]; - + // Center the glow image at the center of the button horizontally and at the bottom of the button vertically glowImageView.frame = CGRectMake(button.frame.size.width/2.0 - glowImage.size.width/2.0, button.frame.origin.y + button.frame.size.height - glowImage.size.height, glowImage.size.width, glowImage.size.height); // Set the glow image view's tag so we can find it later when we want to remove the glow glowImageView.tag = GLOW_IMAGE_TAG; - + // Add the glow image view to the button [button addSubview:glowImageView]; } @@ -194,12 +194,12 @@ - (void) removeGlowAtIndex:(NSInteger)index - (CGFloat) horizontalLocationFor:(NSUInteger)tabIndex { UIImageView* tabBarArrow = (UIImageView*)[self viewWithTag:TAB_ARROW_IMAGE_TAG]; - + // A single tab item's width is the entire width of the tab bar divided by number of items CGFloat tabItemWidth = self.frame.size.width / buttons.count; // A half width is tabItemWidth divided by 2 minus half the width of the arrow CGFloat halfTabItemWidth = (tabItemWidth / 2.0) - (tabBarArrow.frame.size.width / 2.0); - + // The horizontal location is the index times the width plus a half width return (tabIndex * tabItemWidth) + halfTabItemWidth; } @@ -238,9 +238,9 @@ - (UIButton*) buttonAtIndex:(NSUInteger)itemIndex width:(CGFloat)width // Ask the delegate for the highlighted/selected state image & set it as the selected background state [button setBackgroundImage:[delegate selectedItemImage] forState:UIControlStateHighlighted]; [button setBackgroundImage:[delegate selectedItemImage] forState:UIControlStateSelected]; - + button.adjustsImageWhenHighlighted = NO; - + return button; } @@ -249,10 +249,10 @@ -(UIImage*) tabBarImage:(UIImage*)startImage size:(CGSize)targetSize backgroundI { // The background is either the passed in background image (for the blue selected state) or gray (for the non-selected state) UIImage* backgroundImage = [self tabBarBackgroundImageWithSize:startImage.size backgroundImage:backgroundImageSource]; - + // Convert the passed in image to a white backround image with a black fill UIImage* bwImage = [self blackFilledImageWithWhiteBackgroundUsing:startImage]; - + // Create an image mask CGImageRef imageMask = CGImageMaskCreate(CGImageGetWidth(bwImage.CGImage), CGImageGetHeight(bwImage.CGImage), @@ -269,11 +269,11 @@ -(UIImage*) tabBarImage:(UIImage*)startImage size:(CGSize)targetSize backgroundI tabBarImage = [UIImage imageWithCGImage:tabBarImageRef scale:startImage.scale orientation:startImage.imageOrientation]; else tabBarImage = [UIImage imageWithCGImage:tabBarImageRef]; - + // Cleanup CGImageRelease(imageMask); CGImageRelease(tabBarImageRef); - + // Create a new context with the right size if (UIGraphicsBeginImageContextWithOptions) UIGraphicsBeginImageContextWithOptions(targetSize, NO, 0.0); @@ -282,11 +282,11 @@ -(UIImage*) tabBarImage:(UIImage*)startImage size:(CGSize)targetSize backgroundI // Draw the new tab bar image at the center [tabBarImage drawInRect:CGRectMake((targetSize.width/2.0) - (startImage.size.width/2.0), (targetSize.height/2.0) - (startImage.size.height/2.0), startImage.size.width, startImage.size.height)]; - + // Generate a new image UIImage* resultImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); - + return resultImage; } @@ -320,7 +320,7 @@ -(UIImage*) blackFilledImageWithWhiteBackgroundUsing:(UIImage*)startImage // Cleanup CGContextRelease(context); CGImageRelease(newCGImage); - + return newImage; } @@ -344,7 +344,7 @@ -(UIImage*) tabBarBackgroundImageWithSize:(CGSize)targetSize backgroundImage:(UI UIImage* finalBackgroundImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); - + return finalBackgroundImage; } diff --git a/WordPressReimagined/Classes/CustomTabBarViewController.m b/WordPressReimagined/Classes/CustomTabBarViewController.m index 55e9c73..14327c3 100644 --- a/WordPressReimagined/Classes/CustomTabBarViewController.m +++ b/WordPressReimagined/Classes/CustomTabBarViewController.m @@ -75,14 +75,14 @@ - (void)viewDidLoad // Use the TabBarGradient image to figure out the tab bar's height (22x2=44) UIImage* tabBarGradient = [UIImage imageNamed:@"TabBarGradient.png"]; - + // Create a custom tab bar passing in the number of items, the size of each item and setting ourself as the delegate self.tabBar = [[[CustomTabBar alloc] initWithItemCount:viewControllers.count itemSize:CGSizeMake(self.view.frame.size.width/viewControllers.count, tabBarGradient.size.height*2) tag:0 delegate:self] autorelease]; - + // Place the tab bar at the bottom of our view tabBar.frame = CGRectMake(0,self.view.frame.size.height-(tabBarGradient.size.height*2),self.view.frame.size.width, tabBarGradient.size.height*2); [self.view addSubview:tabBar]; - + // Select the first tab [self performSelector:@selector(selectFirstTab) withObject:nil afterDelay:0]; } @@ -124,21 +124,21 @@ - (UIImage*) backgroundImage CGFloat width = self.view.frame.size.width; // Get the image that will form the top of the background UIImage* topImage = [UIImage imageNamed:@"TabBarGradient.png"]; - + // Create a new image context if (UIGraphicsBeginImageContextWithOptions) UIGraphicsBeginImageContextWithOptions(CGSizeMake(width, topImage.size.height*2), NO, 0.0); else UIGraphicsBeginImageContext(CGSizeMake(width, topImage.size.height*2)); - + // Create a stretchable image for the top of the background and draw it UIImage* stretchedTopImage = [topImage stretchableImageWithLeftCapWidth:0 topCapHeight:0]; [stretchedTopImage drawInRect:CGRectMake(0, 0, width, topImage.size.height)]; - + // Draw a solid black color for the bottom of the background [[UIColor blackColor] set]; CGContextFillRect(UIGraphicsGetCurrentContext(), CGRectMake(0, topImage.size.height, width, topImage.size.height)); - + // Generate a new image UIImage* resultImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); @@ -156,7 +156,7 @@ - (UIImage*) selectedItemBackgroundImage - (UIImage*) glowImage { UIImage* tabBarGlow = [UIImage imageNamed:@"TabBarGlow.png"]; - + // Create a new image using the TabBarGlow image but offset 4 pixels down if (UIGraphicsBeginImageContextWithOptions) UIGraphicsBeginImageContextWithOptions(CGSizeMake(tabBarGlow.size.width, tabBarGlow.size.height-4.0), NO, 0.0); @@ -185,12 +185,12 @@ - (UIImage*) selectedItemImage UIGraphicsBeginImageContext(tabBarItemSize); // Create a stretchable image using the TabBarSelection image but offset 4 pixels down - [[[UIImage imageNamed:@"TabBarSelection.png"] stretchableImageWithLeftCapWidth:4.0 topCapHeight:0] drawInRect:CGRectMake(0, 4.0, tabBarItemSize.width, tabBarItemSize.height-4.0)]; + [[[UIImage imageNamed:@"TabBarSelection.png"] stretchableImageWithLeftCapWidth:4.0 topCapHeight:0] drawInRect:CGRectMake(0, 4.0, tabBarItemSize.width, tabBarItemSize.height-4.0)]; // Generate a new image UIImage* selectedItemImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); - + return selectedItemImage; } @@ -202,11 +202,11 @@ - (UIImage*) tabBarArrowImage - (void) touchDownAtItemAtIndex:(NSUInteger)itemIndex { selectedIndex = itemIndex; - + // Remove the current view controller's view UIView* currentView = [self.view viewWithTag:SELECTED_VIEW_CONTROLLER_TAG]; [currentView removeFromSuperview]; - + // Get the right view controller NSDictionary* data = [viewControllers objectAtIndex:itemIndex]; UIViewController* viewController = [data objectForKey:@"viewController"]; @@ -219,14 +219,14 @@ - (void) touchDownAtItemAtIndex:(NSUInteger)itemIndex // Se the tag so we can find it later viewController.view.tag = SELECTED_VIEW_CONTROLLER_TAG; - + // Add the new view controller's view [self.view insertSubview:viewController.view belowSubview:tabBar]; - + [viewController viewWillAppear:NO]; // In 1 second glow the selected tab // [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(addGlowTimerFireMethod:) userInfo:[NSNumber numberWithInteger:itemIndex] repeats:NO]; - + } // - (void)addGlowTimerFireMethod:(NSTimer*)theTimer @@ -236,7 +236,7 @@ - (void) touchDownAtItemAtIndex:(NSUInteger)itemIndex // { // [tabBar removeGlowAtIndex:i]; // } -// +// // // Then add it to this tab bar item // [tabBar glowItemAtIndex:[[theTimer userInfo] integerValue]]; // } @@ -252,7 +252,7 @@ -(UILabel*)labelWithDescription:(NSString*)text label.text = text; [label sizeToFit]; return label; - + } - (void)dealloc { diff --git a/WordPressReimagined/Classes/FreshlyPressedViewController.m b/WordPressReimagined/Classes/FreshlyPressedViewController.m index 54d0d73..acbfea8 100644 --- a/WordPressReimagined/Classes/FreshlyPressedViewController.m +++ b/WordPressReimagined/Classes/FreshlyPressedViewController.m @@ -46,7 +46,7 @@ @implementation FreshlyPressedViewController - (void)viewDidLoad { [super viewDidLoad]; - + tableView.tableHeaderView = tableHeaderView; } @@ -66,7 +66,7 @@ - (void) populate:(FreshlyPressedTableViewCell*)cell atIndexPath:(NSIndexPath*)i CGRect titleFrame = cell.title.frame; titleFrame.size.height = titleHeight; cell.title.frame = titleFrame; - + CGRect subtitleFrame = cell.subtitle.frame; subtitleFrame.origin.y = titleFrame.origin.y + titleFrame.size.height + 2.0; cell.subtitle.frame = subtitleFrame; @@ -82,14 +82,14 @@ - (UITableViewCell *)tableView:(UITableView *)theTableView cellForRowAtIndexPath [[NSBundle mainBundle] loadNibNamed:@"FreshlyPressedTableViewCell" owner:self options:nil]; cell = (FreshlyPressedTableViewCell*)self.tableViewCell; self.tableViewCell = nil; - + cell.imageView.superview.layer.borderColor = [UIColor colorWithRed:223.0/255.0 green:223.0/255.0 blue:223.0/255.0 alpha:1.0].CGColor; cell.imageView.superview.layer.borderWidth = 1.0; } [self populate:cell atIndexPath:indexPath]; [self loadImageForCell:cell]; - + return cell; } @@ -97,11 +97,11 @@ - (void)tableView:(UITableView *)theTableView didSelectRowAtIndexPath:(NSIndexPa { if ([self isMoreCell:indexPath]) return [super tableView:theTableView didSelectRowAtIndexPath:indexPath]; - + ModelObject* modelObject = [collection objectAtIndex:indexPath.row]; WebViewController* webViewController = [[[WebViewController alloc] initWithNibName:@"WebViewController" bundle:nil] autorelease]; webViewController.url = [modelObject objectForKey:@"url"]; - + UINavigationController *navigationController = ((WordPressReimaginedAppDelegate*)[[UIApplication sharedApplication] delegate]).navigationController; [navigationController pushViewController:webViewController animated:YES]; } diff --git a/WordPressReimagined/Classes/ModelObject.m b/WordPressReimagined/Classes/ModelObject.m index d19f0d2..a98ee0d 100644 --- a/WordPressReimagined/Classes/ModelObject.m +++ b/WordPressReimagined/Classes/ModelObject.m @@ -63,9 +63,9 @@ -(void) startDownloadingImageIfNeeded { // if we already have an image or are in the middle of downloading the image if (image || imageConnection) return; - + NSString* imageURL = [attributes objectForKey:imageURLKey]; - + if ([imageURL isKindOfClass:[NSNull class]]) { [self useGenericImage]; @@ -122,16 +122,16 @@ -(NSArray*) getCorrespondingVisibleCells // } // else // selectedViewController = customTabBarViewController.selectedViewController; - + if ([selectedViewController respondsToSelector:@selector(visibleTable)]) { UITableView* tableView = [(UITableView*)selectedViewController performSelector:@selector(visibleTable)]; - + NSArray* visibleCells = tableView.visibleCells; - + if (!visibleCells) return nil; - + NSMutableArray* cells = [[[NSMutableArray alloc] init] autorelease]; for (UITableViewCell* cell in visibleCells) { @@ -146,14 +146,14 @@ -(NSArray*) getCorrespondingVisibleCells if (cells.count > 0) return cells; } - + // if ([navigationController.topViewController respondsToSelector:@selector(defferedDownloadImageView)] && [navigationController.topViewController respondsToSelector:@selector(defferedDownloadModelObject)]) // { // RailsObject* railsObject = [navigationController.topViewController performSelector:@selector(defferedDownloadModelObject)]; // if ([railsObject isEqual:self]) // return [NSArray arrayWithObject:[navigationController.topViewController performSelector:@selector(defferedDownloadImageView)]]; // } - + return nil; } @@ -161,13 +161,13 @@ -(NSArray*) getCorrespondingVisibleCells - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { NSInteger status = [(NSHTTPURLResponse*)response statusCode]; - + if (status != 200) { if (connection == imageConnection) [self handleFailedImageDownload]; } - + if (connection == imageConnection) [imageData setLength:0]; } @@ -191,12 +191,12 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection UIImage* theImage = [[[UIImage alloc] initWithData:imageData] autorelease]; [imageData release], imageData = nil; [imageConnection release], imageConnection = nil; - + if (theImage.size.height > 0 && theImage.size.width > 0) self.image = theImage; else [self useGenericImage]; - + [self updateVisibleCellsWithImage]; } } @@ -204,7 +204,7 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection - (BOOL)isEqual:(ModelObject*)otherObject { if (![otherObject isKindOfClass:[ModelObject class]]) return NO; - + return [[self objectForKey:uniqueIdentifierKey] isEqual:[otherObject objectForKey:uniqueIdentifierKey]]; } diff --git a/WordPressReimagined/Classes/WebViewController.m b/WordPressReimagined/Classes/WebViewController.m index 3088585..5c7ad12 100644 --- a/WordPressReimagined/Classes/WebViewController.m +++ b/WordPressReimagined/Classes/WebViewController.m @@ -42,12 +42,12 @@ @implementation WebViewController - (void) viewWillAppear:(BOOL)animated { [self.navigationController setNavigationBarHidden:NO animated:YES]; - + [self showLoading]; - + NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]]; [webView loadRequest:request]; - + [super viewWillAppear:animated]; } @@ -111,13 +111,13 @@ - (void)webViewDidFinishLoad:(UIWebView *)theWebView { [self hideLoading]; theWebView.backgroundColor = [UIColor whiteColor]; - + NSString* pageTitle = [theWebView stringByEvaluatingJavaScriptFromString:@"document.title"]; self.navigationItem.title = pageTitle; - + UIBarItem* back = [toolbar.items objectAtIndex:backIndex]; back.enabled = [theWebView canGoBack]; - + UIBarItem* forward = [toolbar.items objectAtIndex:forwardIndex]; forward.enabled = [theWebView canGoForward]; } diff --git a/WordPressReimagined/Classes/WordPressReimaginedAppDelegate.m b/WordPressReimagined/Classes/WordPressReimaginedAppDelegate.m index a6447ff..e0aca9e 100644 --- a/WordPressReimagined/Classes/WordPressReimaginedAppDelegate.m +++ b/WordPressReimagined/Classes/WordPressReimaginedAppDelegate.m @@ -56,7 +56,7 @@ - (void)applicationWillResignActive:(UIApplication *)application { - (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. + 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, called instead of applicationWillTerminate: when the user quits. */ } diff --git a/WordPressReimagined/Libraries/JSONKit/JSONKit.h b/WordPressReimagined/Libraries/JSONKit/JSONKit.h index 838ca87..b0f5763 100644 --- a/WordPressReimagined/Libraries/JSONKit/JSONKit.h +++ b/WordPressReimagined/Libraries/JSONKit/JSONKit.h @@ -6,23 +6,23 @@ /* Copyright (c) 2011, John Engelhart - + All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + * Neither the name of the Zang Industries nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -50,11 +50,11 @@ #import #import #endif // __OBJC__ - + #ifdef __cplusplus extern "C" { #endif - + // For Mac OS X < 10.5. #ifndef NSINTEGER_DEFINED diff --git a/WordPressReimagined/Libraries/JSONKit/JSONKit.m b/WordPressReimagined/Libraries/JSONKit/JSONKit.m index 46a27c7..c2cb1eb 100644 --- a/WordPressReimagined/Libraries/JSONKit/JSONKit.m +++ b/WordPressReimagined/Libraries/JSONKit/JSONKit.m @@ -6,23 +6,23 @@ /* Copyright (c) 2011, John Engelhart - + All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + * Neither the name of the Zang Industries nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -59,9 +59,9 @@ The code in isValidCodePoint() is derived from the ICU code in From the original ConvertUTF.[ch]: * Copyright 2001-2004 Unicode, Inc. - * + * * Disclaimer - * + * * This source code is provided as is by Unicode, Inc. No claims are * made as to fitness for any particular purpose. No warranties of any * kind are expressed or implied. The recipient agrees to determine @@ -69,9 +69,9 @@ The code in isValidCodePoint() is derived from the ICU code in * purchased on magnetic or optical media from Unicode, Inc., the * sole remedy for any claim will be exchange of defective media * within 90 days of receipt. - * + * * Limitations on Rights to Redistribute This Code - * + * * Unicode, Inc. hereby grants the right to freely use the information * supplied in this file in the creation of products supporting the * Unicode Standard, and to make copies of this file in any form @@ -133,11 +133,11 @@ The code in isValidCodePoint() is derived from the ICU code in #define JK_ATTRIBUTES(attr, ...) __attribute__((attr, ##__VA_ARGS__)) #define JK_EXPECTED(cond, expect) __builtin_expect((long)(cond), (expect)) #define JK_PREFETCH(ptr) __builtin_prefetch(ptr) -#else // defined (__GNUC__) && (__GNUC__ >= 4) +#else // defined (__GNUC__) && (__GNUC__ >= 4) #define JK_ATTRIBUTES(attr, ...) #define JK_EXPECTED(cond, expect) (cond) #define JK_PREFETCH(ptr) -#endif // defined (__GNUC__) && (__GNUC__ >= 4) +#endif // defined (__GNUC__) && (__GNUC__ >= 4) #define JK_STATIC_INLINE static __inline__ JK_ATTRIBUTES(always_inline) #define JK_ALIGNED(arg) JK_ATTRIBUTES(aligned(arg)) @@ -431,7 +431,7 @@ static void jk_managedBuffer_setToStackBuffer(JKManagedBuffer *managedBuffer, un if((managedBuffer->flags & JKManagedBufferLocationMask) == JKManagedBufferOnStack) { NSCParameterAssert((managedBuffer->flags & JKManagedBufferMustFree) == 0); unsigned char *newBuffer = NULL, *oldBuffer = managedBuffer->bytes.ptr; - + if((newBuffer = (unsigned char *)malloc(roundedUpNewSize)) == NULL) { return(NULL); } memcpy(newBuffer, oldBuffer, jk_min(managedBuffer->bytes.length, roundedUpNewSize)); managedBuffer->flags = (managedBuffer->flags & ~JKManagedBufferLocationMask) | (JKManagedBufferOnHeap | JKManagedBufferMustFree); @@ -572,7 +572,7 @@ static int isLegalUTF8(const UTF8 *source, size_t length) { case 4: if(JK_EXPECTED(((a = (*--srcptr)) < 0x80) || (a > 0xBF), 0U)) { return(0); } case 3: if(JK_EXPECTED(((a = (*--srcptr)) < 0x80) || (a > 0xBF), 0U)) { return(0); } case 2: if(JK_EXPECTED( (a = (*--srcptr)) > 0xBF , 0U)) { return(0); } - + switch(*source) { // no fall-through in this inner switch case 0xE0: if(JK_EXPECTED(a < 0xA0, 0U)) { return(0); } break; case 0xED: if(JK_EXPECTED(a > 0x9F, 0U)) { return(0); } break; @@ -580,7 +580,7 @@ static int isLegalUTF8(const UTF8 *source, size_t length) { case 0xF4: if(JK_EXPECTED(a > 0x8F, 0U)) { return(0); } break; default: if(JK_EXPECTED(a < 0x80, 0U)) { return(0); } } - + case 1: if(JK_EXPECTED((JK_EXPECTED(*source < 0xC2, 0U)) && JK_EXPECTED(*source >= 0x80, 1U), 0U)) { return(0); } } @@ -602,7 +602,7 @@ static ConversionResult ConvertSingleCodePointInUTF8(const UTF8 *sourceStart, co if(JK_EXPECTED((source + extraBytesToRead + 1) > sourceEnd, 0U) || JK_EXPECTED(!isLegalUTF8(source, extraBytesToRead + 1), 0U)) { source++; - while((source < sourceEnd) && (((*source) & 0xc0) == 0x80) && ((source - sourceStart) < (extraBytesToRead + 1))) { source++; } + while((source < sourceEnd) && (((*source) & 0xc0) == 0x80) && ((source - sourceStart) < (extraBytesToRead + 1))) { source++; } NSCParameterAssert(source <= sourceEnd); result = ((source < sourceEnd) && (((*source) & 0xc0) != 0x80)) ? sourceIllegal : ((sourceStart + extraBytesToRead + 1) > sourceEnd) ? sourceExhausted : sourceIllegal; ch = UNI_REPLACEMENT_CHAR; @@ -620,11 +620,11 @@ static ConversionResult ConvertSingleCodePointInUTF8(const UTF8 *sourceStart, co ch -= offsetsFromUTF8[extraBytesToRead]; result = isValidCodePoint(&ch); - + finished: *nextUTF8 = source; *convertedUTF32 = ch; - + return(result); } @@ -644,7 +644,7 @@ static ConversionResult ConvertUTF32toUTF8 (UTF32 u32CodePoint, UTF8 **targetSta else if(ch < (UTF32)0x10000) { bytesToWrite = 3; } else if(ch <= UNI_MAX_LEGAL_UTF32) { bytesToWrite = 4; } else { bytesToWrite = 3; ch = UNI_REPLACEMENT_CHAR; result = sourceIllegal; } - + target += bytesToWrite; if (target > targetEnd) { target -= bytesToWrite; result = targetExhausted; goto finished; } @@ -668,7 +668,7 @@ JK_STATIC_INLINE int jk_string_add_unicodeCodePoint(JKParseState *parseState, ui if((result = ConvertUTF32toUTF8(unicodeCodePoint, &u8s, (parseState->token.tokenBuffer.bytes.ptr + parseState->token.tokenBuffer.bytes.length))) != conversionOK) { if(result == targetExhausted) { return(1); } } size_t utf8len = u8s - &parseState->token.tokenBuffer.bytes.ptr[*tokenBufferIdx], nextIdx = (*tokenBufferIdx) + utf8len; - + while(*tokenBufferIdx < nextIdx) { *stringHash = calculateHash(*stringHash, parseState->token.tokenBuffer.bytes.ptr[(*tokenBufferIdx)++]); } return(0); @@ -693,7 +693,7 @@ static int jk_parse_string(JKParseState *parseState) { unsigned long currentChar; if(JK_EXPECTED(atStringCharacter == endOfBuffer, 0U)) { /* XXX Add error message */ stringState = JSONStringStateError; goto finishedParsing; } - + if(JK_EXPECTED((currentChar = *atStringCharacter++) >= 0x80UL, 0U)) { const unsigned char *nextValidCharacter = NULL; UTF32 u32ch = 0UL; @@ -776,13 +776,13 @@ static int jk_parse_string(JKParseState *parseState) { case '\\': escapedChar = '\\'; goto parsedEscapedChar; case '/': escapedChar = '/'; goto parsedEscapedChar; case '"': escapedChar = '"'; goto parsedEscapedChar; - + parsedEscapedChar: stringState = JSONStringStateParsing; stringHash = calculateHash(stringHash, escapedChar); tokenBuffer[tokenBufferIdx++] = escapedChar; break; - + default: jk_error(parseState, @"Invalid escape sequence found in \"\" string."); stringState = JSONStringStateError; goto finishedParsing; break; } break; @@ -802,14 +802,14 @@ static int jk_parse_string(JKParseState *parseState) { case '0' ... '9': hexValue = currentChar - '0'; goto parsedHex; case 'a' ... 'f': hexValue = (currentChar - 'a') + 10U; goto parsedHex; case 'A' ... 'F': hexValue = (currentChar - 'A') + 10U; goto parsedHex; - + parsedHex: if(!isSurrogate) { escapedUnicode1 = (escapedUnicode1 << 4) | hexValue; } else { escapedUnicode2 = (escapedUnicode2 << 4) | hexValue; } - + if(stringState == JSONStringStateEscapedUnicode4) { if(((escapedUnicode1 >= 0xD800U) && (escapedUnicode1 < 0xE000U))) { if((escapedUnicode1 >= 0xD800U) && (escapedUnicode1 < 0xDC00U)) { stringState = JSONStringStateEscapedNeedEscapeForSurrogate; } - else if((escapedUnicode1 >= 0xDC00U) && (escapedUnicode1 < 0xE000U)) { + else if((escapedUnicode1 >= 0xDC00U) && (escapedUnicode1 < 0xE000U)) { if((parseState->parseOptionFlags & JKParseOptionLooseUnicode)) { escapedUnicodeCodePoint = UNI_REPLACEMENT_CHAR; } else { jk_error(parseState, @"Illegal \\u Unicode escape sequence."); stringState = JSONStringStateError; goto finishedParsing; } } @@ -824,8 +824,8 @@ static int jk_parse_string(JKParseState *parseState) { } else { escapedUnicodeCodePoint = ((escapedUnicode1 - 0xd800) * 0x400) + (escapedUnicode2 - 0xdc00) + 0x10000; } } - - if((stringState == JSONStringStateEscapedUnicode4) || (stringState == JSONStringStateEscapedUnicodeSurrogate4)) { + + if((stringState == JSONStringStateEscapedUnicode4) || (stringState == JSONStringStateEscapedUnicodeSurrogate4)) { if((parseState->parseOptionFlags & JKParseOptionLooseUnicode) == 0) { UTF32 cp = escapedUnicodeCodePoint; if(isValidCodePoint(&cp) == sourceIllegal) { jk_error(parseState, @"Illegal \\u Unicode escape sequence."); stringState = JSONStringStateError; goto finishedParsing; } @@ -874,7 +874,7 @@ static int jk_parse_string(JKParseState *parseState) { parseState->token.value.ptrRange.ptr = parseState->token.tokenBuffer.bytes.ptr; parseState->token.value.ptrRange.length = tokenBufferIdx; } - + parseState->token.value.hash = stringHash; parseState->token.value.type = JKValueTypeString; parseState->atIndex = (atStringCharacter - parseState->stringBuffer.bytes.ptr); @@ -926,7 +926,7 @@ static int jk_parse_number(JKParseState *parseState) { numberTempBuf[parseState->token.tokenPtrRange.length] = 0; errno = 0; - + // Treat "-0" as a floating point number, which is capable of representing negative zeros. if(isNegative && (parseState->token.tokenPtrRange.length == 2UL) && (numberTempBuf[1] == '0')) { isFloatingPoint = 1; } @@ -1405,7 +1405,7 @@ - (id)parseUTF8String:(const unsigned char *)string length:(size_t)length // This needs to be completely rewritten. - (id)parseUTF8String:(const unsigned char *)string length:(size_t)length error:(NSError **)error { - if(string == NULL) { [NSException raise:NSInvalidArgumentException format:@"The string argument is NULL."]; } + if(string == NULL) { [NSException raise:NSInvalidArgumentException format:@"The string argument is NULL."]; } if((error != NULL) && (*error != NULL)) { *error = NULL; } parseState.stringBuffer.bytes.ptr = string; @@ -1456,7 +1456,7 @@ - (id)parseJSONData:(NSData *)jsonData - (id)parseJSONData:(NSData *)jsonData error:(NSError **)error { - if(jsonData == NULL) { [NSException raise:NSInvalidArgumentException format:@"The jsonData argument is NULL."]; } + if(jsonData == NULL) { [NSException raise:NSInvalidArgumentException format:@"The jsonData argument is NULL."]; } return([self parseUTF8String:(const unsigned char *)[jsonData bytes] length:[jsonData length] error:error]); } @@ -1634,17 +1634,17 @@ static int jk_encode_add_atom_to_buffer(JKEncodeState *encodeState, void *object { CFIndex stringLength = CFStringGetLength((CFStringRef)object); CFIndex maxStringUTF8Length = CFStringGetMaximumSizeForEncoding(stringLength, kCFStringEncodingUTF8) + 32L; - + if(((size_t)maxStringUTF8Length > encodeState->utf8ConversionBuffer.bytes.length) && (jk_managedBuffer_resize(&encodeState->utf8ConversionBuffer, maxStringUTF8Length + 1024UL) == NULL)) { jk_encode_error(encodeState, @"Unable to resize temporary buffer."); return(1); } - + CFIndex usedBytes = 0L, convertedCount = 0L; convertedCount = CFStringGetBytes((CFStringRef)object, CFRangeMake(0L, stringLength), kCFStringEncodingUTF8, '?', NO, encodeState->utf8ConversionBuffer.bytes.ptr, encodeState->utf8ConversionBuffer.bytes.length - 16L, &usedBytes); encodeState->utf8ConversionBuffer.bytes.ptr[usedBytes] = 0; - + if(((encodeState->atIndex + maxStringUTF8Length) > encodeState->stringBuffer.bytes.length) && (jk_managedBuffer_resize(&encodeState->stringBuffer, encodeState->atIndex + maxStringUTF8Length + 1024UL) == NULL)) { jk_encode_error(encodeState, @"Unable to resize temporary buffer."); return(1); } - + const unsigned char *utf8String = encodeState->utf8ConversionBuffer.bytes.ptr; - + size_t utf8Idx = 0UL; encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\"'; for(utf8Idx = 0UL; utf8String[utf8Idx] != 0; utf8Idx++) { @@ -1700,7 +1700,7 @@ static int jk_encode_add_atom_to_buffer(JKEncodeState *encodeState, void *object anum[255] = 0; switch(objCType[0]) { - case 'c': case 'i': case 's': case 'l': case 'q': + case 'c': case 'i': case 's': case 'l': case 'q': if(CFNumberGetValue((CFNumberRef)object, kCFNumberLongLongType, &llv)) { if(llv < 0LL) { llv = -llv; isNegative = 1; } if(llv < 10LL) { *--aptr = llv + '0'; } else { while(llv > 0LL) { *--aptr = (llv % 10LL) + '0'; llv /= 10LL; } } @@ -1725,7 +1725,7 @@ static int jk_encode_add_atom_to_buffer(JKEncodeState *encodeState, void *object } } break; - + case JKClassArray: { int printComma = 0;