Browse files

- Updated copyright info

- Added license
- Updated README.md
  • Loading branch information...
1 parent 5325677 commit d50fb93542294adc18c20865c8b7b981695b18d4 @Baglan committed Jul 21, 2012
View
2 Classes/MCPagerView.h
@@ -3,7 +3,7 @@
// MCPagerView
//
// Created by Baglan on 7/20/12.
-// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+// Copyright (c) 2012 MobileCreators. All rights reserved.
//
#import <UIKit/UIKit.h>
View
2 Classes/MCPagerView.m
@@ -3,7 +3,7 @@
// MCPagerView
//
// Created by Baglan on 7/20/12.
-// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+// Copyright (c) 2012 MobileCreators. All rights reserved.
//
#import "MCPagerView.h"
View
8 LICENSE.md
@@ -0,0 +1,8 @@
+# The MIT License (MIT)
+Copyright (c) 2012 MobileCreators
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
BIN MCPagerView.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
5 MCPagerView.xcodeproj/project.pbxproj
@@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
+ 86D5790B15BA64B20025F83D /* MCPagerView.png in Resources */ = {isa = PBXBuildFile; fileRef = 86D5790A15BA64B20025F83D /* MCPagerView.png */; };
86E5E62A15B9A622001A7579 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86E5E62915B9A622001A7579 /* UIKit.framework */; };
86E5E62C15B9A622001A7579 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86E5E62B15B9A622001A7579 /* Foundation.framework */; };
86E5E62E15B9A622001A7579 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86E5E62D15B9A622001A7579 /* CoreGraphics.framework */; };
@@ -33,6 +34,7 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
+ 86D5790A15BA64B20025F83D /* MCPagerView.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = MCPagerView.png; sourceTree = "<group>"; };
86E5E62515B9A622001A7579 /* MCPagerView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MCPagerView.app; sourceTree = BUILT_PRODUCTS_DIR; };
86E5E62915B9A622001A7579 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
86E5E62B15B9A622001A7579 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
@@ -81,6 +83,7 @@
86E5E61A15B9A621001A7579 = {
isa = PBXGroup;
children = (
+ 86D5790A15BA64B20025F83D /* MCPagerView.png */,
86E5E66815B9CE4C001A7579 /* LICENSE.md */,
86E5E66615B9CE40001A7579 /* README.md */,
86E5E64D15B9B8FB001A7579 /* Assets */,
@@ -227,6 +230,7 @@
86E5E66515B9BC71001A7579 /* c@2x.png in Resources */,
86E5E66715B9CE40001A7579 /* README.md in Resources */,
86E5E66915B9CE4C001A7579 /* LICENSE.md in Resources */,
+ 86D5790B15BA64B20025F83D /* MCPagerView.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -352,6 +356,7 @@
86E5E64515B9A622001A7579 /* Release */,
);
defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
View
2 MCPagerView/AppDelegate.h
@@ -3,7 +3,7 @@
// MCPagerView
//
// Created by Baglan on 7/20/12.
-// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+// Copyright (c) 2012 MobileCreators. All rights reserved.
//
#import <UIKit/UIKit.h>
View
2 MCPagerView/AppDelegate.m
@@ -3,7 +3,7 @@
// MCPagerView
//
// Created by Baglan on 7/20/12.
-// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+// Copyright (c) 2012 MobileCreators. All rights reserved.
//
#import "AppDelegate.h"
View
2 MCPagerView/ViewController.h
@@ -3,7 +3,7 @@
// MCPagerView
//
// Created by Baglan on 7/20/12.
-// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+// Copyright (c) 2012 MobileCreators. All rights reserved.
//
#import <UIKit/UIKit.h>
View
2 MCPagerView/ViewController.m
@@ -3,7 +3,7 @@
// MCPagerView
//
// Created by Baglan on 7/20/12.
-// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+// Copyright (c) 2012 MobileCreators. All rights reserved.
//
#import "ViewController.h"
View
2 MCPagerView/main.m
@@ -3,7 +3,7 @@
// MCPagerView
//
// Created by Baglan on 7/20/12.
-// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+// Copyright (c) 2012 MobileCreators. All rights reserved.
//
#import <UIKit/UIKit.h>
View
65 README.md
@@ -0,0 +1,65 @@
+# MCPagerView
+
+## Project goal
+
+Make a replacement for the UIPageControl, with a similar functionality but custom "dots".
+
+Here is a screenshot from the sample project:
+
+![Sample project screenshot](MCPagerView.png)
+
+## License
+
+This code is available under the MIT license.
+
+## Installation
+
+1. Drag files from the Classes folder to your project;
+2. \#import "MCPagerView.h" wherever you want to use it.
+
+## Usage
+
+Initialize the MCPagerView as you would do with any other view: either add a view in the Interface Builder and set a "MCPagerView" class on it or create one programmatically with a code like this:
+
+ [MCPagerView alloc] initWithFrame:CGRectMake(0,0,6*44,44)];
+
+Actual values will depend on the sizes and the number of "dots".
+
+Set the "pattern". Number of characters in the pattern will determine the number of pages and what kind of "dot" will be used for each of them. Here is the example from the sample project:
+
+ [pagerView setPattern:@"abcabc"];
+
+This pager will have 6 pages with dot types "a", "b" and "c".
+
+Now images should be specied for each of the dot types:
+
+ [pagerView setImage:[UIImage imageNamed:@"a"]
+ highlightedImage:[UIImage imageNamed:@"a-h"]
+ forKey:@"a"];
+
+In this example, dot "a" is set up with "a.png" as the default value and "a-h.png" as a "highlighted" value. Dot is highlighted when it corresponds to the current "page" property.
+
+Current page can be read or set by accessing the "page" property:
+
+ pagerView.page = 3;
+
+A delegate can be set to receive updates to the pager:
+
+ pagerView.delegate = self;
+
+Delegate should implement the "MCPagerViewDelegate" protocol. This protocol has two optional methods:
+
+ - (BOOL)pageView:(MCPagerView *)pageView shouldUpdateToPage:(NSInteger)newPage;
+ - (void)pageView:(MCPagerView *)pageView didUpdateToPage:(NSInteger)newPage;
+
+Here is a simple "go to page" code from the sample project:
+
+ - (void)pageView:(MCPagerView *)pageView didUpdateToPage:(NSInteger)newPage
+ {
+ CGPoint offset = CGPointMake(scrollView.frame.size.width * pagerView.page, 0);
+ [scrollView setContentOffset:offset animated:YES];
+ }
+
+Alternatively, an object can observe the "MCPAGERVIEW_DID_UPDATE_NOTIFICTAION" notification on the default notification center:
+
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onPageChange) name:MCPAGERVIEW_DID_UPDATE_NOTIFICTAION object:pagerView];

0 comments on commit d50fb93

Please sign in to comment.