Permalink
Browse files

Code cleanup.

  • Loading branch information...
1 parent 500e063 commit 3299770f967a844a92f0aecda3bcc44e1470d618 @hollance committed Oct 9, 2011
@@ -51,7 +51,7 @@
7B5F0440136302F3006782F8 /* Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Prefix.pch; sourceTree = "<group>"; };
7B94AC4A136BF9900079ECCB /* PageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageView.h; sourceTree = "<group>"; };
7B94AC4B136BF9900079ECCB /* PageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PageView.m; sourceTree = "<group>"; };
- 7BC2ED63136C3A4100A9D610 /* MHPagingScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; path = MHPagingScrollView.h; sourceTree = "<group>"; };
+ 7BC2ED63136C3A4100A9D610 /* MHPagingScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MHPagingScrollView.h; sourceTree = "<group>"; };
7BC2ED64136C3A4100A9D610 /* MHPagingScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MHPagingScrollView.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -166,6 +166,7 @@
7B0F4C8A1363017C00DE4938 /* Project object */ = {
isa = PBXProject;
attributes = {
+ LastUpgradeCheck = 0420;
ORGANIZATIONNAME = Hollance;
};
buildConfigurationList = 7B0F4C8D1363017C00DE4938 /* Build configuration list for PBXProject "Paging" */;
@@ -230,7 +231,6 @@
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = DEBUG;
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
- GCC_VERSION = com.apple.compilers.llvmgcc42;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
@@ -244,7 +244,6 @@
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_C_LANGUAGE_STANDARD = gnu99;
- GCC_VERSION = com.apple.compilers.llvmgcc42;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
@@ -264,6 +263,8 @@
INFOPLIST_FILE = Resources/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 3.0;
PRODUCT_NAME = "$(TARGET_NAME)";
+ RUN_CLANG_STATIC_ANALYZER = YES;
+ WARNING_CFLAGS = "-Wall";
WRAPPER_EXTENSION = app;
};
name = Debug;
@@ -278,7 +279,9 @@
INFOPLIST_FILE = Resources/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 3.0;
PRODUCT_NAME = "$(TARGET_NAME)";
+ RUN_CLANG_STATIC_ANALYZER = YES;
VALIDATE_PRODUCT = YES;
+ WARNING_CFLAGS = "-Wall";
WRAPPER_EXTENSION = app;
};
name = Release;
View
@@ -3,7 +3,7 @@
{
}
-@property (nonatomic, retain) IBOutlet UIWindow* window;
-@property (nonatomic, retain) IBOutlet UIViewController* viewController;
+@property (nonatomic, retain) IBOutlet UIWindow *window;
+@property (nonatomic, retain) IBOutlet UIViewController *viewController;
@end
View
@@ -5,7 +5,7 @@ @implementation AppDelegate
@synthesize window, viewController;
-- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[self.window addSubview:self.viewController.view];
[self.window makeKeyAndVisible];
@@ -6,8 +6,8 @@
int numPages;
}
-@property (nonatomic, retain) IBOutlet MHPagingScrollView* pagingScrollView;
-@property (nonatomic, retain) IBOutlet UIPageControl* pageControl;
+@property (nonatomic, retain) IBOutlet MHPagingScrollView *pagingScrollView;
+@property (nonatomic, retain) IBOutlet UIPageControl *pageControl;
- (IBAction)pageTurn;
@@ -71,13 +71,13 @@ - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInte
#pragma mark -
#pragma mark UIScrollViewDelegate
-- (void)scrollViewDidScroll:(UIScrollView*)theScrollView
+- (void)scrollViewDidScroll:(UIScrollView *)theScrollView
{
pageControl.currentPage = [pagingScrollView indexOfSelectedPage];
[pagingScrollView scrollViewDidScroll];
}
-- (void)scrollViewDidEndDecelerating:(UIScrollView*)theScrollView
+- (void)scrollViewDidEndDecelerating:(UIScrollView *)theScrollView
{
if ([pagingScrollView indexOfSelectedPage] == numPages - 1)
{
@@ -90,14 +90,14 @@ - (void)scrollViewDidEndDecelerating:(UIScrollView*)theScrollView
#pragma mark -
#pragma mark MHPagingScrollViewDelegate
-- (NSInteger)numberOfPagesInPagingScrollView:(MHPagingScrollView*)pagingScrollView
+- (NSInteger)numberOfPagesInPagingScrollView:(MHPagingScrollView *)pagingScrollView
{
return numPages;
}
-- (UIView*)pagingScrollView:(MHPagingScrollView*)thePagingScrollView pageForIndex:(NSInteger)index
+- (UIView *)pagingScrollView:(MHPagingScrollView *)thePagingScrollView pageForIndex:(NSInteger)index
{
- PageView* pageView = (PageView*)[thePagingScrollView dequeueReusablePage];
+ PageView *pageView = (PageView *)[thePagingScrollView dequeueReusablePage];
if (pageView == nil)
pageView = [[[PageView alloc] init] autorelease];
@@ -53,13 +53,13 @@
/*!
* Asks the delegate to return the number of pages.
*/
-- (NSInteger)numberOfPagesInPagingScrollView:(MHPagingScrollView*)pagingScrollView;
+- (NSInteger)numberOfPagesInPagingScrollView:(MHPagingScrollView *)pagingScrollView;
/*!
* Asks the delegate for a page to insert. The delegate should ask for a
* reusable view using dequeueReusablePageView.
*/
-- (UIView*)pagingScrollView:(MHPagingScrollView*)pagingScrollView pageForIndex:(NSInteger)index;
+- (UIView *)pagingScrollView:(MHPagingScrollView *)pagingScrollView pageForIndex:(NSInteger)index;
@end
@@ -73,16 +73,9 @@
* property.
*/
@interface MHPagingScrollView : UIScrollView
-{
- NSMutableSet* recycledPages;
- NSMutableSet* visiblePages;
-
- int firstVisiblePageIndexBeforeRotation; // for autorotation
- CGFloat percentScrolledIntoFirstVisiblePage;
-}
/*! The delegate for paging events. */
-@property (nonatomic, assign) IBOutlet id<MHPagingScrollViewDelegate> pagingDelegate;
+@property (nonatomic, assign) IBOutlet id <MHPagingScrollViewDelegate> pagingDelegate;
/*! The width of the preview pages. */
@property (nonatomic, assign) UIEdgeInsets previewInsets;
@@ -100,7 +93,7 @@
/*!
* Returns a reusable UIView object.
*/
-- (UIView*)dequeueReusablePage;
+- (UIView *)dequeueReusablePage;
/*!
* Reloads the pages. Call this method when the number of pages has changed.
@@ -46,17 +46,16 @@ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
#import "MHPagingScrollView.h"
@interface MHPage : NSObject
-{
-}
-@property (nonatomic, retain) UIView* view;
+@property (nonatomic, retain) UIView *view;
@property (nonatomic, assign) NSInteger index;
@end
@implementation MHPage
-@synthesize view, index;
+@synthesize view;
+@synthesize index;
- (void)dealloc
{
@@ -67,10 +66,18 @@ - (void)dealloc
@end
@implementation MHPagingScrollView
+{
+ NSMutableSet *recycledPages;
+ NSMutableSet *visiblePages;
+
+ int firstVisiblePageIndexBeforeRotation; // for autorotation
+ CGFloat percentScrolledIntoFirstVisiblePage;
+}
-@synthesize previewInsets, pagingDelegate;
+@synthesize previewInsets;
+@synthesize pagingDelegate;
-- (void)setup
+- (void)commonInit
{
recycledPages = [[NSMutableSet alloc] init];
visiblePages = [[NSMutableSet alloc] init];
@@ -85,16 +92,16 @@ - (id)initWithFrame:(CGRect)frame
{
if ((self = [super initWithFrame:frame]))
{
- [self setup];
+ [self commonInit];
}
return self;
}
-- (id)initWithCoder:(NSCoder*)aDecoder
+- (id)initWithCoder:(NSCoder *)aDecoder
{
if ((self = [super initWithCoder:aDecoder]))
{
- [self setup];
+ [self commonInit];
}
return self;
}
@@ -106,7 +113,7 @@ - (void)dealloc
[super dealloc];
}
-- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent*)event
+- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
{
// This allows for touch handling outside of the scroll view's bounds.
@@ -156,20 +163,20 @@ - (CGSize)contentSizeForPagingScrollView
- (BOOL)isDisplayingPageForIndex:(NSUInteger)index
{
- for (MHPage* page in visiblePages)
+ for (MHPage *page in visiblePages)
{
if (page.index == index)
return YES;
}
return NO;
}
-- (UIView*)dequeueReusablePage
+- (UIView *)dequeueReusablePage
{
- MHPage* page = [recycledPages anyObject];
+ MHPage *page = [recycledPages anyObject];
if (page != nil)
{
- UIView* view = [[page.view retain] autorelease];
+ UIView *view = [[page.view retain] autorelease];
[recycledPages removeObject:page];
return view;
}
@@ -195,7 +202,7 @@ - (void)tilePages
firstNeededPageIndex = MAX(firstNeededPageIndex, 0);
lastNeededPageIndex = MIN(lastNeededPageIndex, [self numberOfPages] - 1);
- for (MHPage* page in visiblePages)
+ for (MHPage *page in visiblePages)
{
if (page.index < firstNeededPageIndex || page.index > lastNeededPageIndex)
{
@@ -210,11 +217,11 @@ - (void)tilePages
{
if (![self isDisplayingPageForIndex:i])
{
- UIView* pageView = [pagingDelegate pagingScrollView:self pageForIndex:i];
+ UIView *pageView = [pagingDelegate pagingScrollView:self pageForIndex:i];
pageView.frame = [self frameForPageAtIndex:i];
[self addSubview:pageView];
- MHPage* page = [[MHPage alloc] init];
+ MHPage *page = [[MHPage alloc] init];
page.index = i;
page.view = pageView;
[visiblePages addObject:page];
@@ -251,7 +258,7 @@ - (void)afterRotation
{
self.contentSize = [self contentSizeForPagingScrollView];
- for (MHPage* page in visiblePages)
+ for (MHPage *page in visiblePages)
page.view.frame = [self frameForPageAtIndex:page.index];
CGFloat pageWidth = self.bounds.size.width;
View
@@ -1,7 +1,5 @@
@interface PageView : UILabel
-{
-}
- (void)setPageIndex:(int)newIndex;
View
@@ -1,7 +1,7 @@
-int main(int argc, char* argv[])
+int main(int argc, char *argv[])
{
- NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;

0 comments on commit 3299770

Please sign in to comment.