├── .gitignore ├── LICENSE ├── README.md ├── SupertopGrid.podspec ├── grid.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── padraig.xcuserdatad │ └── xcschemes │ ├── grid.xcscheme │ └── xcschememanagement.plist ├── grid ├── Base.lproj │ └── Main.storyboard ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── SUPAppDelegate.h ├── SUPAppDelegate.m ├── SUPGridWindow │ ├── SUPGridView.h │ ├── SUPGridView.m │ ├── SUPGridWindow.h │ └── SUPGridWindow.m ├── SUPViewController.h ├── SUPViewController.m ├── en.lproj │ └── InfoPlist.strings ├── grid-Info.plist ├── grid-Prefix.pch └── main.m ├── gridTests ├── en.lproj │ └── InfoPlist.strings ├── gridTests-Info.plist └── gridTests.m └── screenshot.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | .DS_Store 3 | */build/* 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | profile 14 | *.moved-aside 15 | DerivedData 16 | .idea/ 17 | *.hmap 18 | *.xccheckout 19 | 20 | #CocoaPods 21 | Pods 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 supertop 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Supertop Grid 2 | 3 | A grid overlay for iOS apps. 4 | 5 | Use this during the development of your app to help align your interface to a grid, and 6 | easily spot layout issues. It will overlay every view in your app, but not interfere with 7 | interaction, so you can still move around. 8 | 9 | A simple example app is included. 10 | 11 | ## How To Use 12 | 13 | 1. Add SUPGridWindow and SUPGridView to your project. 14 | 2. Configure the grid size and color. 15 | 3. Optionally add a gesture to toggle the grid on or off. 16 | 17 | Example 18 | ------- 19 | 20 | ``` 21 | SUPGridWindow *grid = [SUPGridWindow sharedGridWindow]; 22 | 23 | [grid setGridColor:[UIColor redColor]]; 24 | [grid setMajorGridSize:CGSizeMake(40, 40)]; 25 | [grid setMinorGridSize:CGSizeMake(10, 10)]; 26 | ``` 27 | 28 | Screenshot 29 | ---------- 30 | 31 | ![The Grid](https://raw.githubusercontent.com/supertop/grid-window/master/screenshot.png?1) 32 | 33 | Notes 34 | ----- 35 | 36 | * This is a development tool. You probably want to make sure you don't ship with this. The 37 | window is added above all others, so it will even overlay the keyboard and the status bar. Apple doesn't like 38 | that. 39 | 40 | * The right gesture to toggle the grid will vary app to app, so we didn't set any by default. 41 | 42 | To Do 43 | ----- 44 | 45 | * The ability to scroll the grid along with scrollviews. 46 | -------------------------------------------------------------------------------- /SupertopGrid.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod spec lint SupertopGrid.podspec' to ensure this is a 3 | # valid spec and to remove all comments including this before submitting the spec. 4 | # 5 | # To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html 6 | # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | 11 | # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 12 | # 13 | # These will help people to find your library, and whilst it 14 | # can feel like a chore to fill in it's definitely to your advantage. The 15 | # summary should be tweet-length, and the description more in depth. 16 | # 17 | 18 | s.name = "SupertopGrid" 19 | s.version = "1.0" 20 | s.summary = "A grid overlay for iOS apps." 21 | 22 | s.description = <<-DESC 23 | Use this during the development of your app to help align your interface 24 | to a grid, and easily spot layout issues. It will overlay every view in 25 | your app, but not interfere with interaction, so you can still move around. 26 | DESC 27 | 28 | s.homepage = "https://github.com/supertop/grid-window" 29 | s.screenshots = "https://raw.githubusercontent.com/supertop/grid-window/master/screenshot.png?1" 30 | 31 | 32 | # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 33 | # 34 | # Licensing your code is important. See http://choosealicense.com for more info. 35 | # CocoaPods will detect a license file if there is a named LICENSE* 36 | # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'. 37 | # 38 | 39 | s.license = { :type => "MIT", :file => "LICENSE" } 40 | 41 | 42 | # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 43 | # 44 | # Specify the authors of the library, with email addresses. Email addresses 45 | # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also 46 | # accepts just a name if you'd rather not provide an email address. 47 | # 48 | # Specify a social_media_url where others can refer to, for example a twitter 49 | # profile URL. 50 | # 51 | 52 | s.authors = { "Padraig Kennedy" => "padraig@supertop.co", 53 | "Oisin Prendiville" => "oisin@supertop.co" } 54 | s.social_media_url = "http://twitter.com/supertopsquid" 55 | 56 | # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 57 | # 58 | # If this Pod runs only on iOS or OS X, then specify the platform and 59 | # the deployment target. You can optionally include the target after the platform. 60 | # 61 | 62 | # s.platform = :ios 63 | s.platform = :ios, "7.0" 64 | 65 | # When using multiple platforms 66 | # s.ios.deployment_target = "5.0" 67 | # s.osx.deployment_target = "10.7" 68 | 69 | 70 | # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 71 | # 72 | # Specify the location from where the source should be retrieved. 73 | # Supports git, hg, bzr, svn and HTTP. 74 | # 75 | 76 | s.source = { :git => "https://github.com/supertop/grid-window.git", :tag => "1.0.1" } 77 | 78 | 79 | # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 80 | # 81 | # CocoaPods is smart about how it includes source code. For source files 82 | # giving a folder will include any h, m, mm, c & cpp files. For header 83 | # files it will include any header in the folder. 84 | # Not including the public_header_files will make all headers public. 85 | # 86 | 87 | s.source_files = "Grid/SUPGridWindow" 88 | # s.exclude_files = "Classes/Exclude" 89 | # s.public_header_files = "Classes/**/*.h" 90 | 91 | 92 | # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 93 | # 94 | # A list of resources included with the Pod. These are copied into the 95 | # target bundle with a build phase script. Anything else will be cleaned. 96 | # You can preserve files from being cleaned, please don't preserve 97 | # non-essential files like tests, examples and documentation. 98 | # 99 | 100 | # s.resource = "icon.png" 101 | # s.resources = "Resources/*.png" 102 | 103 | # s.preserve_paths = "FilesToSave", "MoreFilesToSave" 104 | 105 | 106 | # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 107 | # 108 | # Link your library with frameworks, or libraries. Libraries do not include 109 | # the lib prefix of their name. 110 | # 111 | 112 | # s.framework = "SomeFramework" 113 | # s.frameworks = "SomeFramework", "AnotherFramework" 114 | 115 | # s.library = "iconv" 116 | # s.libraries = "iconv", "xml2" 117 | 118 | 119 | # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 120 | # 121 | # If your library depends on compiler flags you can set them in the xcconfig hash 122 | # where they will only apply to your library. If you depend on other Podspecs 123 | # you can include multiple dependencies to ensure it works. 124 | 125 | s.requires_arc = true 126 | 127 | # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } 128 | # s.dependency "JSONKit", "~> 1.4" 129 | 130 | end 131 | -------------------------------------------------------------------------------- /grid.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1A1C2FEB18E20AC000CF7B34 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A1C2FEA18E20AC000CF7B34 /* Foundation.framework */; }; 11 | 1A1C2FED18E20AC000CF7B34 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A1C2FEC18E20AC000CF7B34 /* CoreGraphics.framework */; }; 12 | 1A1C2FEF18E20AC000CF7B34 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A1C2FEE18E20AC000CF7B34 /* UIKit.framework */; }; 13 | 1A1C2FF518E20AC000CF7B34 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1A1C2FF318E20AC000CF7B34 /* InfoPlist.strings */; }; 14 | 1A1C2FF718E20AC000CF7B34 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A1C2FF618E20AC000CF7B34 /* main.m */; }; 15 | 1A1C2FFB18E20AC000CF7B34 /* SUPAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A1C2FFA18E20AC000CF7B34 /* SUPAppDelegate.m */; }; 16 | 1A1C2FFE18E20AC000CF7B34 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1A1C2FFC18E20AC000CF7B34 /* Main.storyboard */; }; 17 | 1A1C300118E20AC000CF7B34 /* SUPViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A1C300018E20AC000CF7B34 /* SUPViewController.m */; }; 18 | 1A1C300318E20AC000CF7B34 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1A1C300218E20AC000CF7B34 /* Images.xcassets */; }; 19 | 1A1C300A18E20AC000CF7B34 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A1C300918E20AC000CF7B34 /* XCTest.framework */; }; 20 | 1A1C300B18E20AC000CF7B34 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A1C2FEA18E20AC000CF7B34 /* Foundation.framework */; }; 21 | 1A1C300C18E20AC000CF7B34 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A1C2FEE18E20AC000CF7B34 /* UIKit.framework */; }; 22 | 1A1C301418E20AC000CF7B34 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1A1C301218E20AC000CF7B34 /* InfoPlist.strings */; }; 23 | 1A1C301618E20AC000CF7B34 /* gridTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A1C301518E20AC000CF7B34 /* gridTests.m */; }; 24 | 1A1C302A18E20B1D00CF7B34 /* SUPGridView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A1C302718E20B1D00CF7B34 /* SUPGridView.m */; }; 25 | 1A1C302B18E20B1D00CF7B34 /* SUPGridWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A1C302918E20B1D00CF7B34 /* SUPGridWindow.m */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXContainerItemProxy section */ 29 | 1A1C300D18E20AC000CF7B34 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = 1A1C2FDF18E20AC000CF7B34 /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = 1A1C2FE618E20AC000CF7B34; 34 | remoteInfo = grid; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 1A1C2FE718E20AC000CF7B34 /* grid.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = grid.app; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | 1A1C2FEA18E20AC000CF7B34 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 41 | 1A1C2FEC18E20AC000CF7B34 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 42 | 1A1C2FEE18E20AC000CF7B34 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 43 | 1A1C2FF218E20AC000CF7B34 /* grid-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "grid-Info.plist"; sourceTree = ""; }; 44 | 1A1C2FF418E20AC000CF7B34 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 45 | 1A1C2FF618E20AC000CF7B34 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 46 | 1A1C2FF818E20AC000CF7B34 /* grid-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "grid-Prefix.pch"; sourceTree = ""; }; 47 | 1A1C2FF918E20AC000CF7B34 /* SUPAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUPAppDelegate.h; sourceTree = ""; }; 48 | 1A1C2FFA18E20AC000CF7B34 /* SUPAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SUPAppDelegate.m; sourceTree = ""; }; 49 | 1A1C2FFD18E20AC000CF7B34 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 50 | 1A1C2FFF18E20AC000CF7B34 /* SUPViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUPViewController.h; sourceTree = ""; }; 51 | 1A1C300018E20AC000CF7B34 /* SUPViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SUPViewController.m; sourceTree = ""; }; 52 | 1A1C300218E20AC000CF7B34 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 53 | 1A1C300818E20AC000CF7B34 /* gridTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = gridTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 54 | 1A1C300918E20AC000CF7B34 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 55 | 1A1C301118E20AC000CF7B34 /* gridTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "gridTests-Info.plist"; sourceTree = ""; }; 56 | 1A1C301318E20AC000CF7B34 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 57 | 1A1C301518E20AC000CF7B34 /* gridTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = gridTests.m; sourceTree = ""; }; 58 | 1A1C302618E20B1D00CF7B34 /* SUPGridView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUPGridView.h; sourceTree = ""; }; 59 | 1A1C302718E20B1D00CF7B34 /* SUPGridView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUPGridView.m; sourceTree = ""; }; 60 | 1A1C302818E20B1D00CF7B34 /* SUPGridWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUPGridWindow.h; sourceTree = ""; }; 61 | 1A1C302918E20B1D00CF7B34 /* SUPGridWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUPGridWindow.m; sourceTree = ""; }; 62 | /* End PBXFileReference section */ 63 | 64 | /* Begin PBXFrameworksBuildPhase section */ 65 | 1A1C2FE418E20AC000CF7B34 /* Frameworks */ = { 66 | isa = PBXFrameworksBuildPhase; 67 | buildActionMask = 2147483647; 68 | files = ( 69 | 1A1C2FED18E20AC000CF7B34 /* CoreGraphics.framework in Frameworks */, 70 | 1A1C2FEF18E20AC000CF7B34 /* UIKit.framework in Frameworks */, 71 | 1A1C2FEB18E20AC000CF7B34 /* Foundation.framework in Frameworks */, 72 | ); 73 | runOnlyForDeploymentPostprocessing = 0; 74 | }; 75 | 1A1C300518E20AC000CF7B34 /* Frameworks */ = { 76 | isa = PBXFrameworksBuildPhase; 77 | buildActionMask = 2147483647; 78 | files = ( 79 | 1A1C300A18E20AC000CF7B34 /* XCTest.framework in Frameworks */, 80 | 1A1C300C18E20AC000CF7B34 /* UIKit.framework in Frameworks */, 81 | 1A1C300B18E20AC000CF7B34 /* Foundation.framework in Frameworks */, 82 | ); 83 | runOnlyForDeploymentPostprocessing = 0; 84 | }; 85 | /* End PBXFrameworksBuildPhase section */ 86 | 87 | /* Begin PBXGroup section */ 88 | 1A1C2FDE18E20AC000CF7B34 = { 89 | isa = PBXGroup; 90 | children = ( 91 | 1A1C2FF018E20AC000CF7B34 /* grid */, 92 | 1A1C300F18E20AC000CF7B34 /* gridTests */, 93 | 1A1C2FE918E20AC000CF7B34 /* Frameworks */, 94 | 1A1C2FE818E20AC000CF7B34 /* Products */, 95 | ); 96 | sourceTree = ""; 97 | }; 98 | 1A1C2FE818E20AC000CF7B34 /* Products */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 1A1C2FE718E20AC000CF7B34 /* grid.app */, 102 | 1A1C300818E20AC000CF7B34 /* gridTests.xctest */, 103 | ); 104 | name = Products; 105 | sourceTree = ""; 106 | }; 107 | 1A1C2FE918E20AC000CF7B34 /* Frameworks */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 1A1C2FEA18E20AC000CF7B34 /* Foundation.framework */, 111 | 1A1C2FEC18E20AC000CF7B34 /* CoreGraphics.framework */, 112 | 1A1C2FEE18E20AC000CF7B34 /* UIKit.framework */, 113 | 1A1C300918E20AC000CF7B34 /* XCTest.framework */, 114 | ); 115 | name = Frameworks; 116 | sourceTree = ""; 117 | }; 118 | 1A1C2FF018E20AC000CF7B34 /* grid */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | 1A1C302518E20B1D00CF7B34 /* SUPGridWindow */, 122 | 1A1C2FF918E20AC000CF7B34 /* SUPAppDelegate.h */, 123 | 1A1C2FFA18E20AC000CF7B34 /* SUPAppDelegate.m */, 124 | 1A1C2FFC18E20AC000CF7B34 /* Main.storyboard */, 125 | 1A1C2FFF18E20AC000CF7B34 /* SUPViewController.h */, 126 | 1A1C300018E20AC000CF7B34 /* SUPViewController.m */, 127 | 1A1C300218E20AC000CF7B34 /* Images.xcassets */, 128 | 1A1C2FF118E20AC000CF7B34 /* Supporting Files */, 129 | ); 130 | path = grid; 131 | sourceTree = ""; 132 | }; 133 | 1A1C2FF118E20AC000CF7B34 /* Supporting Files */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 1A1C2FF218E20AC000CF7B34 /* grid-Info.plist */, 137 | 1A1C2FF318E20AC000CF7B34 /* InfoPlist.strings */, 138 | 1A1C2FF618E20AC000CF7B34 /* main.m */, 139 | 1A1C2FF818E20AC000CF7B34 /* grid-Prefix.pch */, 140 | ); 141 | name = "Supporting Files"; 142 | sourceTree = ""; 143 | }; 144 | 1A1C300F18E20AC000CF7B34 /* gridTests */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | 1A1C301518E20AC000CF7B34 /* gridTests.m */, 148 | 1A1C301018E20AC000CF7B34 /* Supporting Files */, 149 | ); 150 | path = gridTests; 151 | sourceTree = ""; 152 | }; 153 | 1A1C301018E20AC000CF7B34 /* Supporting Files */ = { 154 | isa = PBXGroup; 155 | children = ( 156 | 1A1C301118E20AC000CF7B34 /* gridTests-Info.plist */, 157 | 1A1C301218E20AC000CF7B34 /* InfoPlist.strings */, 158 | ); 159 | name = "Supporting Files"; 160 | sourceTree = ""; 161 | }; 162 | 1A1C302518E20B1D00CF7B34 /* SUPGridWindow */ = { 163 | isa = PBXGroup; 164 | children = ( 165 | 1A1C302618E20B1D00CF7B34 /* SUPGridView.h */, 166 | 1A1C302718E20B1D00CF7B34 /* SUPGridView.m */, 167 | 1A1C302818E20B1D00CF7B34 /* SUPGridWindow.h */, 168 | 1A1C302918E20B1D00CF7B34 /* SUPGridWindow.m */, 169 | ); 170 | path = SUPGridWindow; 171 | sourceTree = ""; 172 | }; 173 | /* End PBXGroup section */ 174 | 175 | /* Begin PBXNativeTarget section */ 176 | 1A1C2FE618E20AC000CF7B34 /* grid */ = { 177 | isa = PBXNativeTarget; 178 | buildConfigurationList = 1A1C301918E20AC000CF7B34 /* Build configuration list for PBXNativeTarget "grid" */; 179 | buildPhases = ( 180 | 1A1C2FE318E20AC000CF7B34 /* Sources */, 181 | 1A1C2FE418E20AC000CF7B34 /* Frameworks */, 182 | 1A1C2FE518E20AC000CF7B34 /* Resources */, 183 | ); 184 | buildRules = ( 185 | ); 186 | dependencies = ( 187 | ); 188 | name = grid; 189 | productName = grid; 190 | productReference = 1A1C2FE718E20AC000CF7B34 /* grid.app */; 191 | productType = "com.apple.product-type.application"; 192 | }; 193 | 1A1C300718E20AC000CF7B34 /* gridTests */ = { 194 | isa = PBXNativeTarget; 195 | buildConfigurationList = 1A1C301C18E20AC000CF7B34 /* Build configuration list for PBXNativeTarget "gridTests" */; 196 | buildPhases = ( 197 | 1A1C300418E20AC000CF7B34 /* Sources */, 198 | 1A1C300518E20AC000CF7B34 /* Frameworks */, 199 | 1A1C300618E20AC000CF7B34 /* Resources */, 200 | ); 201 | buildRules = ( 202 | ); 203 | dependencies = ( 204 | 1A1C300E18E20AC000CF7B34 /* PBXTargetDependency */, 205 | ); 206 | name = gridTests; 207 | productName = gridTests; 208 | productReference = 1A1C300818E20AC000CF7B34 /* gridTests.xctest */; 209 | productType = "com.apple.product-type.bundle.unit-test"; 210 | }; 211 | /* End PBXNativeTarget section */ 212 | 213 | /* Begin PBXProject section */ 214 | 1A1C2FDF18E20AC000CF7B34 /* Project object */ = { 215 | isa = PBXProject; 216 | attributes = { 217 | CLASSPREFIX = SUP; 218 | LastUpgradeCheck = 0510; 219 | ORGANIZATIONNAME = "Padraig Kennedy"; 220 | TargetAttributes = { 221 | 1A1C300718E20AC000CF7B34 = { 222 | TestTargetID = 1A1C2FE618E20AC000CF7B34; 223 | }; 224 | }; 225 | }; 226 | buildConfigurationList = 1A1C2FE218E20AC000CF7B34 /* Build configuration list for PBXProject "grid" */; 227 | compatibilityVersion = "Xcode 3.2"; 228 | developmentRegion = English; 229 | hasScannedForEncodings = 0; 230 | knownRegions = ( 231 | en, 232 | Base, 233 | ); 234 | mainGroup = 1A1C2FDE18E20AC000CF7B34; 235 | productRefGroup = 1A1C2FE818E20AC000CF7B34 /* Products */; 236 | projectDirPath = ""; 237 | projectRoot = ""; 238 | targets = ( 239 | 1A1C2FE618E20AC000CF7B34 /* grid */, 240 | 1A1C300718E20AC000CF7B34 /* gridTests */, 241 | ); 242 | }; 243 | /* End PBXProject section */ 244 | 245 | /* Begin PBXResourcesBuildPhase section */ 246 | 1A1C2FE518E20AC000CF7B34 /* Resources */ = { 247 | isa = PBXResourcesBuildPhase; 248 | buildActionMask = 2147483647; 249 | files = ( 250 | 1A1C300318E20AC000CF7B34 /* Images.xcassets in Resources */, 251 | 1A1C2FF518E20AC000CF7B34 /* InfoPlist.strings in Resources */, 252 | 1A1C2FFE18E20AC000CF7B34 /* Main.storyboard in Resources */, 253 | ); 254 | runOnlyForDeploymentPostprocessing = 0; 255 | }; 256 | 1A1C300618E20AC000CF7B34 /* Resources */ = { 257 | isa = PBXResourcesBuildPhase; 258 | buildActionMask = 2147483647; 259 | files = ( 260 | 1A1C301418E20AC000CF7B34 /* InfoPlist.strings in Resources */, 261 | ); 262 | runOnlyForDeploymentPostprocessing = 0; 263 | }; 264 | /* End PBXResourcesBuildPhase section */ 265 | 266 | /* Begin PBXSourcesBuildPhase section */ 267 | 1A1C2FE318E20AC000CF7B34 /* Sources */ = { 268 | isa = PBXSourcesBuildPhase; 269 | buildActionMask = 2147483647; 270 | files = ( 271 | 1A1C300118E20AC000CF7B34 /* SUPViewController.m in Sources */, 272 | 1A1C302B18E20B1D00CF7B34 /* SUPGridWindow.m in Sources */, 273 | 1A1C302A18E20B1D00CF7B34 /* SUPGridView.m in Sources */, 274 | 1A1C2FF718E20AC000CF7B34 /* main.m in Sources */, 275 | 1A1C2FFB18E20AC000CF7B34 /* SUPAppDelegate.m in Sources */, 276 | ); 277 | runOnlyForDeploymentPostprocessing = 0; 278 | }; 279 | 1A1C300418E20AC000CF7B34 /* Sources */ = { 280 | isa = PBXSourcesBuildPhase; 281 | buildActionMask = 2147483647; 282 | files = ( 283 | 1A1C301618E20AC000CF7B34 /* gridTests.m in Sources */, 284 | ); 285 | runOnlyForDeploymentPostprocessing = 0; 286 | }; 287 | /* End PBXSourcesBuildPhase section */ 288 | 289 | /* Begin PBXTargetDependency section */ 290 | 1A1C300E18E20AC000CF7B34 /* PBXTargetDependency */ = { 291 | isa = PBXTargetDependency; 292 | target = 1A1C2FE618E20AC000CF7B34 /* grid */; 293 | targetProxy = 1A1C300D18E20AC000CF7B34 /* PBXContainerItemProxy */; 294 | }; 295 | /* End PBXTargetDependency section */ 296 | 297 | /* Begin PBXVariantGroup section */ 298 | 1A1C2FF318E20AC000CF7B34 /* InfoPlist.strings */ = { 299 | isa = PBXVariantGroup; 300 | children = ( 301 | 1A1C2FF418E20AC000CF7B34 /* en */, 302 | ); 303 | name = InfoPlist.strings; 304 | sourceTree = ""; 305 | }; 306 | 1A1C2FFC18E20AC000CF7B34 /* Main.storyboard */ = { 307 | isa = PBXVariantGroup; 308 | children = ( 309 | 1A1C2FFD18E20AC000CF7B34 /* Base */, 310 | ); 311 | name = Main.storyboard; 312 | sourceTree = ""; 313 | }; 314 | 1A1C301218E20AC000CF7B34 /* InfoPlist.strings */ = { 315 | isa = PBXVariantGroup; 316 | children = ( 317 | 1A1C301318E20AC000CF7B34 /* en */, 318 | ); 319 | name = InfoPlist.strings; 320 | sourceTree = ""; 321 | }; 322 | /* End PBXVariantGroup section */ 323 | 324 | /* Begin XCBuildConfiguration section */ 325 | 1A1C301718E20AC000CF7B34 /* Debug */ = { 326 | isa = XCBuildConfiguration; 327 | buildSettings = { 328 | ALWAYS_SEARCH_USER_PATHS = NO; 329 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 330 | CLANG_CXX_LIBRARY = "libc++"; 331 | CLANG_ENABLE_MODULES = YES; 332 | CLANG_ENABLE_OBJC_ARC = YES; 333 | CLANG_WARN_BOOL_CONVERSION = YES; 334 | CLANG_WARN_CONSTANT_CONVERSION = YES; 335 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 336 | CLANG_WARN_EMPTY_BODY = YES; 337 | CLANG_WARN_ENUM_CONVERSION = YES; 338 | CLANG_WARN_INT_CONVERSION = YES; 339 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 340 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 341 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 342 | COPY_PHASE_STRIP = NO; 343 | GCC_C_LANGUAGE_STANDARD = gnu99; 344 | GCC_DYNAMIC_NO_PIC = NO; 345 | GCC_OPTIMIZATION_LEVEL = 0; 346 | GCC_PREPROCESSOR_DEFINITIONS = ( 347 | "DEBUG=1", 348 | "$(inherited)", 349 | ); 350 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 351 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 352 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 353 | GCC_WARN_UNDECLARED_SELECTOR = YES; 354 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 355 | GCC_WARN_UNUSED_FUNCTION = YES; 356 | GCC_WARN_UNUSED_VARIABLE = YES; 357 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 358 | ONLY_ACTIVE_ARCH = YES; 359 | SDKROOT = iphoneos; 360 | }; 361 | name = Debug; 362 | }; 363 | 1A1C301818E20AC000CF7B34 /* Release */ = { 364 | isa = XCBuildConfiguration; 365 | buildSettings = { 366 | ALWAYS_SEARCH_USER_PATHS = NO; 367 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 368 | CLANG_CXX_LIBRARY = "libc++"; 369 | CLANG_ENABLE_MODULES = YES; 370 | CLANG_ENABLE_OBJC_ARC = YES; 371 | CLANG_WARN_BOOL_CONVERSION = YES; 372 | CLANG_WARN_CONSTANT_CONVERSION = YES; 373 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 374 | CLANG_WARN_EMPTY_BODY = YES; 375 | CLANG_WARN_ENUM_CONVERSION = YES; 376 | CLANG_WARN_INT_CONVERSION = YES; 377 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 378 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 379 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 380 | COPY_PHASE_STRIP = YES; 381 | ENABLE_NS_ASSERTIONS = NO; 382 | GCC_C_LANGUAGE_STANDARD = gnu99; 383 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 384 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 385 | GCC_WARN_UNDECLARED_SELECTOR = YES; 386 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 387 | GCC_WARN_UNUSED_FUNCTION = YES; 388 | GCC_WARN_UNUSED_VARIABLE = YES; 389 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 390 | SDKROOT = iphoneos; 391 | VALIDATE_PRODUCT = YES; 392 | }; 393 | name = Release; 394 | }; 395 | 1A1C301A18E20AC000CF7B34 /* Debug */ = { 396 | isa = XCBuildConfiguration; 397 | buildSettings = { 398 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 399 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 400 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 401 | GCC_PREFIX_HEADER = "grid/grid-Prefix.pch"; 402 | INFOPLIST_FILE = "grid/grid-Info.plist"; 403 | PRODUCT_NAME = "$(TARGET_NAME)"; 404 | WRAPPER_EXTENSION = app; 405 | }; 406 | name = Debug; 407 | }; 408 | 1A1C301B18E20AC000CF7B34 /* Release */ = { 409 | isa = XCBuildConfiguration; 410 | buildSettings = { 411 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 412 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 413 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 414 | GCC_PREFIX_HEADER = "grid/grid-Prefix.pch"; 415 | INFOPLIST_FILE = "grid/grid-Info.plist"; 416 | PRODUCT_NAME = "$(TARGET_NAME)"; 417 | WRAPPER_EXTENSION = app; 418 | }; 419 | name = Release; 420 | }; 421 | 1A1C301D18E20AC000CF7B34 /* Debug */ = { 422 | isa = XCBuildConfiguration; 423 | buildSettings = { 424 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/grid.app/grid"; 425 | FRAMEWORK_SEARCH_PATHS = ( 426 | "$(SDKROOT)/Developer/Library/Frameworks", 427 | "$(inherited)", 428 | "$(DEVELOPER_FRAMEWORKS_DIR)", 429 | ); 430 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 431 | GCC_PREFIX_HEADER = "grid/grid-Prefix.pch"; 432 | GCC_PREPROCESSOR_DEFINITIONS = ( 433 | "DEBUG=1", 434 | "$(inherited)", 435 | ); 436 | INFOPLIST_FILE = "gridTests/gridTests-Info.plist"; 437 | PRODUCT_NAME = "$(TARGET_NAME)"; 438 | TEST_HOST = "$(BUNDLE_LOADER)"; 439 | WRAPPER_EXTENSION = xctest; 440 | }; 441 | name = Debug; 442 | }; 443 | 1A1C301E18E20AC000CF7B34 /* Release */ = { 444 | isa = XCBuildConfiguration; 445 | buildSettings = { 446 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/grid.app/grid"; 447 | FRAMEWORK_SEARCH_PATHS = ( 448 | "$(SDKROOT)/Developer/Library/Frameworks", 449 | "$(inherited)", 450 | "$(DEVELOPER_FRAMEWORKS_DIR)", 451 | ); 452 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 453 | GCC_PREFIX_HEADER = "grid/grid-Prefix.pch"; 454 | INFOPLIST_FILE = "gridTests/gridTests-Info.plist"; 455 | PRODUCT_NAME = "$(TARGET_NAME)"; 456 | TEST_HOST = "$(BUNDLE_LOADER)"; 457 | WRAPPER_EXTENSION = xctest; 458 | }; 459 | name = Release; 460 | }; 461 | /* End XCBuildConfiguration section */ 462 | 463 | /* Begin XCConfigurationList section */ 464 | 1A1C2FE218E20AC000CF7B34 /* Build configuration list for PBXProject "grid" */ = { 465 | isa = XCConfigurationList; 466 | buildConfigurations = ( 467 | 1A1C301718E20AC000CF7B34 /* Debug */, 468 | 1A1C301818E20AC000CF7B34 /* Release */, 469 | ); 470 | defaultConfigurationIsVisible = 0; 471 | defaultConfigurationName = Release; 472 | }; 473 | 1A1C301918E20AC000CF7B34 /* Build configuration list for PBXNativeTarget "grid" */ = { 474 | isa = XCConfigurationList; 475 | buildConfigurations = ( 476 | 1A1C301A18E20AC000CF7B34 /* Debug */, 477 | 1A1C301B18E20AC000CF7B34 /* Release */, 478 | ); 479 | defaultConfigurationIsVisible = 0; 480 | }; 481 | 1A1C301C18E20AC000CF7B34 /* Build configuration list for PBXNativeTarget "gridTests" */ = { 482 | isa = XCConfigurationList; 483 | buildConfigurations = ( 484 | 1A1C301D18E20AC000CF7B34 /* Debug */, 485 | 1A1C301E18E20AC000CF7B34 /* Release */, 486 | ); 487 | defaultConfigurationIsVisible = 0; 488 | }; 489 | /* End XCConfigurationList section */ 490 | }; 491 | rootObject = 1A1C2FDF18E20AC000CF7B34 /* Project object */; 492 | } 493 | -------------------------------------------------------------------------------- /grid.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /grid.xcodeproj/xcuserdata/padraig.xcuserdatad/xcschemes/grid.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /grid.xcodeproj/xcuserdata/padraig.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | grid.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 1A1C2FE618E20AC000CF7B34 16 | 17 | primary 18 | 19 | 20 | 1A1C300718E20AC000CF7B34 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /grid/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /grid/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /grid/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /grid/SUPAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // SUPAppDelegate.h 3 | // grid 4 | // 5 | // Created by Padraig O Cinneide on 2014-03-25. 6 | // Copyright (c) 2014 Supertop. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SUPAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /grid/SUPAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // SUPAppDelegate.m 3 | // grid 4 | // 5 | // Created by Padraig O Cinneide on 2014-03-25. 6 | // Copyright (c) 2014 Supertop. All rights reserved. 7 | // 8 | 9 | #import "SUPAppDelegate.h" 10 | #import "SUPGridWindow.h" 11 | 12 | @implementation SUPAppDelegate 13 | 14 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 15 | { 16 | // Override point for customization after application launch. 17 | 18 | SUPGridWindow *grid = [SUPGridWindow sharedGridWindow]; 19 | 20 | [grid setGridColor:[UIColor redColor]]; 21 | [grid setMajorGridSize:CGSizeMake(40, 40)]; 22 | [grid setMinorGridSize:CGSizeMake(10, 10)]; 23 | 24 | return YES; 25 | } 26 | 27 | - (void)applicationWillResignActive:(UIApplication *)application 28 | { 29 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 30 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 31 | } 32 | 33 | - (void)applicationDidEnterBackground:(UIApplication *)application 34 | { 35 | // 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. 36 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 37 | } 38 | 39 | - (void)applicationWillEnterForeground:(UIApplication *)application 40 | { 41 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 42 | } 43 | 44 | - (void)applicationDidBecomeActive:(UIApplication *)application 45 | { 46 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 47 | } 48 | 49 | - (void)applicationWillTerminate:(UIApplication *)application 50 | { 51 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /grid/SUPGridWindow/SUPGridView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SUPGridView.h 3 | // Castro 4 | // 5 | // Created by Padraig O Cinneide on 2014-03-24. 6 | // Copyright (c) 2014 Supertop. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SUPGridView : UIView 12 | 13 | @property (nonatomic, assign) CGSize majorGridSize; 14 | @property (nonatomic, assign) CGSize minorGridSize; 15 | @property (nonatomic, strong) UIColor *gridColor; 16 | 17 | @property (nonatomic, assign) BOOL startFromBottom; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /grid/SUPGridWindow/SUPGridView.m: -------------------------------------------------------------------------------- 1 | // 2 | // SUPGridView.m 3 | // Castro 4 | // 5 | // Created by Padraig O Cinneide on 2014-03-24. 6 | // Copyright (c) 2014 Supertop. All rights reserved. 7 | // 8 | 9 | #import "SUPGridView.h" 10 | 11 | @interface SUPGridView() 12 | 13 | @property (nonatomic, strong) UIColor *lightColor; 14 | @property (nonatomic, strong) UIColor *strongColor; 15 | 16 | @end 17 | 18 | #define SINGLE_PIXEL (1.0f / [[UIScreen mainScreen] scale]) 19 | 20 | @implementation SUPGridView 21 | 22 | - (id)initWithFrame:(CGRect)frame 23 | { 24 | self = [super initWithFrame:frame]; 25 | if (self) { 26 | self.gridColor = [UIColor redColor]; 27 | 28 | self.minorGridSize = CGSizeMake(5, 5); 29 | self.majorGridSize = CGSizeMake(20, 20); 30 | self.startFromBottom = NO; 31 | self.opaque = NO; 32 | self.backgroundColor = [UIColor clearColor]; 33 | } 34 | return self; 35 | } 36 | 37 | - (void)setStartFromBottom:(BOOL)startFromBottom 38 | { 39 | _startFromBottom = startFromBottom; 40 | 41 | [self setNeedsDisplay]; 42 | } 43 | 44 | - (void)setGridColor:(UIColor *)gridColor 45 | { 46 | _gridColor = gridColor; 47 | 48 | self.lightColor = [gridColor colorWithAlphaComponent:0.3]; 49 | self.strongColor = [gridColor colorWithAlphaComponent:0.5]; 50 | } 51 | 52 | - (void)drawRect:(CGRect)rect 53 | { 54 | CGContextRef context = UIGraphicsGetCurrentContext(); 55 | CGContextClearRect(context, rect); 56 | CGContextSetShouldAntialias(context, NO); 57 | 58 | if (self.startFromBottom) { 59 | for (CGFloat y = self.bounds.size.height; y > 0; y = y - self.minorGridSize.height) 60 | { 61 | [self setLineAttributesForPosition:self.bounds.size.height - y]; 62 | [self drawLineAtYPosition:y]; 63 | } 64 | } else { 65 | for (CGFloat y = 0; y < self.bounds.size.height; y = y + self.minorGridSize.height) 66 | { 67 | [self setLineAttributesForPosition:y]; 68 | [self drawLineAtYPosition:y]; 69 | } 70 | } 71 | 72 | 73 | for (CGFloat x = 0; x < self.bounds.size.width; x = x + self.minorGridSize.width) 74 | { 75 | [self setLineAttributesForPosition:x]; 76 | [self drawLineAtXPosition:x]; 77 | } 78 | } 79 | 80 | - (void)setLineAttributesForPosition:(CGFloat)pos 81 | { 82 | CGContextRef context = UIGraphicsGetCurrentContext(); 83 | CGFloat dashes[2] = {1,1}; 84 | 85 | if (fmodf(pos, self.majorGridSize.width) == 0) { 86 | CGContextSetStrokeColorWithColor(context, self.strongColor.CGColor); 87 | CGContextSetLineDash(context, 1, dashes, 0); 88 | } else { 89 | CGContextSetStrokeColorWithColor(context, self.lightColor.CGColor); 90 | CGContextSetLineDash(context, 1, dashes, 2); 91 | } 92 | } 93 | 94 | 95 | - (void)drawLineAtYPosition:(CGFloat)yPos 96 | { 97 | yPos = round(yPos)+SINGLE_PIXEL; 98 | 99 | CGContextRef context = UIGraphicsGetCurrentContext(); 100 | 101 | CGContextSetLineWidth(context, SINGLE_PIXEL); 102 | 103 | CGContextMoveToPoint(context, 0, yPos); //start at this point 104 | CGContextAddLineToPoint(context, self.bounds.size.width, yPos); //draw to this point 105 | 106 | CGContextStrokePath(context); 107 | } 108 | 109 | - (void)drawLineAtXPosition:(CGFloat)xPos 110 | { 111 | xPos = round(xPos); 112 | 113 | CGContextRef context = UIGraphicsGetCurrentContext(); 114 | 115 | CGContextSetLineWidth(context, SINGLE_PIXEL); 116 | 117 | CGContextMoveToPoint(context, xPos, 0); //start at this point 118 | CGContextAddLineToPoint(context, xPos, self.bounds.size.height); //draw to this point 119 | 120 | CGContextStrokePath(context); 121 | } 122 | 123 | @end 124 | -------------------------------------------------------------------------------- /grid/SUPGridWindow/SUPGridWindow.h: -------------------------------------------------------------------------------- 1 | // 2 | // SUPGridWindow.h 3 | // Castro 4 | // 5 | // Created by Padraig O Cinneide on 2014-03-24. 6 | // Copyright (c) 2014 Supertop. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SUPGridWindow : UIWindow 12 | 13 | + (instancetype)sharedGridWindow; 14 | 15 | - (void)toggleHidden; 16 | 17 | - (void)setStartFromBottom:(BOOL)bottom; 18 | - (void)setMajorGridSize:(CGSize)gridSize; 19 | - (void)setMinorGridSize:(CGSize)gridSize; 20 | - (void)setGridColor:(UIColor *)gridColor; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /grid/SUPGridWindow/SUPGridWindow.m: -------------------------------------------------------------------------------- 1 | // 2 | // SUPGridWindow.m 3 | // Castro 4 | // 5 | // Created by Padraig O Cinneide on 2014-03-24. 6 | // Copyright (c) 2014 Supertop. All rights reserved. 7 | // 8 | 9 | #import "SUPGridWindow.h" 10 | #import "SUPGridView.h" 11 | 12 | @interface SUPGridWindow() 13 | 14 | @property (nonatomic, strong) SUPGridView *gridView; 15 | 16 | @end 17 | 18 | @implementation SUPGridWindow 19 | 20 | + (instancetype)sharedGridWindow 21 | { 22 | static id _sharedClient; 23 | static dispatch_once_t onceToken; 24 | dispatch_once(&onceToken, ^{ 25 | _sharedClient = [[[self class] alloc] init]; 26 | }); 27 | return _sharedClient; 28 | } 29 | 30 | 31 | - (id)init 32 | { 33 | return [self initWithFrame:[[UIScreen mainScreen] bounds]]; 34 | } 35 | 36 | - (id)initWithFrame:(CGRect)frame 37 | { 38 | self = [super initWithFrame:frame]; 39 | if (self) { 40 | // Initialization code 41 | self.windowLevel = UIWindowLevelStatusBar+1.0f; 42 | self.gridView = [[SUPGridView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 43 | 44 | [self addSubview:self.gridView]; 45 | 46 | self.hidden = NO; 47 | self.userInteractionEnabled = NO; 48 | } 49 | return self; 50 | } 51 | 52 | - (void)toggleHidden 53 | { 54 | self.hidden = !self.hidden; 55 | } 56 | 57 | - (void)setStartFromBottom:(BOOL)bottom 58 | { 59 | [self.gridView setStartFromBottom:bottom]; 60 | } 61 | 62 | - (void)setMinorGridSize:(CGSize)gridSize 63 | { 64 | [self.gridView setMinorGridSize:gridSize]; 65 | } 66 | 67 | - (void)setMajorGridSize:(CGSize)gridSize 68 | { 69 | [self.gridView setMajorGridSize:gridSize]; 70 | } 71 | 72 | - (void)setGridColor:(UIColor *)color 73 | { 74 | [self.gridView setGridColor:color]; 75 | } 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /grid/SUPViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SUPViewController.h 3 | // grid 4 | // 5 | // Created by Padraig O Cinneide on 2014-03-25. 6 | // Copyright (c) 2014 Supertop. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SUPViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /grid/SUPViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SUPViewController.m 3 | // grid 4 | // 5 | // Created by Padraig O Cinneide on 2014-03-25. 6 | // Copyright (c) 2014 Supertop. All rights reserved. 7 | // 8 | 9 | #import "SUPViewController.h" 10 | #import "SUPGridWindow.h" 11 | 12 | @interface SUPViewController () 13 | 14 | @end 15 | 16 | @implementation SUPViewController 17 | 18 | - (void)viewDidLoad 19 | { 20 | [super viewDidLoad]; 21 | // Do any additional setup after loading the view, typically from a nib. 22 | } 23 | 24 | - (void)didReceiveMemoryWarning 25 | { 26 | [super didReceiveMemoryWarning]; 27 | // Dispose of any resources that can be recreated. 28 | } 29 | 30 | - (IBAction)toggleGrid:(id)sender 31 | { 32 | [[SUPGridWindow sharedGridWindow] toggleHidden]; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /grid/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /grid/grid-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | co.supertop.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /grid/grid-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /grid/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // grid 4 | // 5 | // Created by Padraig O Cinneide on 2014-03-25. 6 | // Copyright (c) 2014 Supertop. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "SUPAppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([SUPAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /gridTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /gridTests/gridTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | co.supertop.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /gridTests/gridTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // gridTests.m 3 | // gridTests 4 | // 5 | // Created by Padraig O Cinneide on 2014-03-25. 6 | // Copyright (c) 2014 Supertop. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface gridTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation gridTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertop/grid-window/320f30ef7ac4cb48f361a87b1496df3879ea92f6/screenshot.png --------------------------------------------------------------------------------