Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

initial commit

  • Loading branch information...
commit a7a28bca5e36ed1253f445542715165c2b868a8a 0 parents
@kgn authored
9 .gitignore
@@ -0,0 +1,9 @@
+xcuserdata
+.DS_Store
+html
+appledoc
+*.pyc
+user.*.espressostorage
+Sparkle/*.app
+*.zip
+PXListView
BIN  Example/Default-568h@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  Example/Default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  Example/Default@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 Example/KGAppDelegate.h
@@ -0,0 +1,15 @@
+//
+// KGAppDelegate.h
+// KGDiscreteAlertViewExample
+//
+// Created by David Keegan on 10/24/12.
+// Copyright (c) 2012 David Keegan. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface KGAppDelegate : UIResponder <UIApplicationDelegate>
+
+@property (strong, nonatomic) UIWindow *window;
+
+@end
25 Example/KGAppDelegate.m
@@ -0,0 +1,25 @@
+//
+// KGAppDelegate.m
+// KGDiscreteAlertViewExample
+//
+// Created by David Keegan on 10/24/12.
+// Copyright (c) 2012 David Keegan. All rights reserved.
+//
+
+#import "KGAppDelegate.h"
+#import "KGDiscreteAlertView.h"
+#import "KGViewController.h"
+
+@implementation KGAppDelegate
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
+ self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
+
+ KGViewController *viewController = [[KGViewController alloc] initWithNibName:nil bundle:nil];
+ self.window.rootViewController = viewController;
+
+ [self.window makeKeyAndVisible];
+ return YES;
+}
+
+@end
38 Example/KGDiscreteAlertViewExample-Info.plist
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.davidkeegan.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>UIRequiredDeviceCapabilities</key>
+ <array>
+ <string>armv7</string>
+ </array>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+</dict>
+</plist>
272 Example/KGDiscreteAlertViewExample.xcodeproj/project.pbxproj
@@ -0,0 +1,272 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 7308BB9D1638BFB600C8DCDE /* KGDiscreteAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7308BB9C1638BFB600C8DCDE /* KGDiscreteAlertView.m */; };
+ 737C8D4B1638BED10066F127 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 737C8D4A1638BED10066F127 /* UIKit.framework */; };
+ 737C8D4D1638BED10066F127 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 737C8D4C1638BED10066F127 /* Foundation.framework */; };
+ 737C8D4F1638BED10066F127 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 737C8D4E1638BED10066F127 /* CoreGraphics.framework */; };
+ 73A8F7DA163B05C300C35E58 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 73A8F7D0163B05C300C35E58 /* Default-568h@2x.png */; };
+ 73A8F7DB163B05C300C35E58 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 73A8F7D1163B05C300C35E58 /* Default.png */; };
+ 73A8F7DC163B05C300C35E58 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 73A8F7D2163B05C300C35E58 /* Default@2x.png */; };
+ 73A8F7DD163B05C300C35E58 /* KGAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 73A8F7D4163B05C300C35E58 /* KGAppDelegate.m */; };
+ 73A8F7DF163B05C300C35E58 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 73A8F7D9163B05C300C35E58 /* main.m */; };
+ 73A8F7E8163B084D00C35E58 /* KGViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 73A8F7E6163B084D00C35E58 /* KGViewController.m */; };
+ 73A8F7E9163B084D00C35E58 /* KGViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 73A8F7E7163B084D00C35E58 /* KGViewController.xib */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 7308BB9B1638BFB600C8DCDE /* KGDiscreteAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KGDiscreteAlertView.h; path = ../KGDiscreteAlertView.h; sourceTree = "<group>"; };
+ 7308BB9C1638BFB600C8DCDE /* KGDiscreteAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = KGDiscreteAlertView.m; path = ../KGDiscreteAlertView.m; sourceTree = "<group>"; };
+ 737C8D461638BED10066F127 /* KGDiscreteAlertViewExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = KGDiscreteAlertViewExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 737C8D4A1638BED10066F127 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+ 737C8D4C1638BED10066F127 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ 737C8D4E1638BED10066F127 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
+ 73A8F7D0163B05C300C35E58 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
+ 73A8F7D1163B05C300C35E58 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
+ 73A8F7D2163B05C300C35E58 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = "<group>"; };
+ 73A8F7D3163B05C300C35E58 /* KGAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KGAppDelegate.h; sourceTree = "<group>"; };
+ 73A8F7D4163B05C300C35E58 /* KGAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KGAppDelegate.m; sourceTree = "<group>"; };
+ 73A8F7D9163B05C300C35E58 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 73A8F7E5163B084D00C35E58 /* KGViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KGViewController.h; sourceTree = "<group>"; };
+ 73A8F7E6163B084D00C35E58 /* KGViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KGViewController.m; sourceTree = "<group>"; };
+ 73A8F7E7163B084D00C35E58 /* KGViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KGViewController.xib; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 737C8D431638BED10066F127 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 737C8D4B1638BED10066F127 /* UIKit.framework in Frameworks */,
+ 737C8D4D1638BED10066F127 /* Foundation.framework in Frameworks */,
+ 737C8D4F1638BED10066F127 /* CoreGraphics.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 737C8D3B1638BED10066F127 = {
+ isa = PBXGroup;
+ children = (
+ 7308BB9B1638BFB600C8DCDE /* KGDiscreteAlertView.h */,
+ 7308BB9C1638BFB600C8DCDE /* KGDiscreteAlertView.m */,
+ 73A8F7CF163B05C300C35E58 /* KGDiscreteAlertViewExample */,
+ 737C8D491638BED10066F127 /* Frameworks */,
+ 737C8D471638BED10066F127 /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ 737C8D471638BED10066F127 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 737C8D461638BED10066F127 /* KGDiscreteAlertViewExample.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 737C8D491638BED10066F127 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 737C8D4A1638BED10066F127 /* UIKit.framework */,
+ 737C8D4C1638BED10066F127 /* Foundation.framework */,
+ 737C8D4E1638BED10066F127 /* CoreGraphics.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ 73A8F7CF163B05C300C35E58 /* KGDiscreteAlertViewExample */ = {
+ isa = PBXGroup;
+ children = (
+ 73A8F7D9163B05C300C35E58 /* main.m */,
+ 73A8F7D3163B05C300C35E58 /* KGAppDelegate.h */,
+ 73A8F7D4163B05C300C35E58 /* KGAppDelegate.m */,
+ 73A8F7E5163B084D00C35E58 /* KGViewController.h */,
+ 73A8F7E6163B084D00C35E58 /* KGViewController.m */,
+ 73A8F7E7163B084D00C35E58 /* KGViewController.xib */,
+ 73A8F7D0163B05C300C35E58 /* Default-568h@2x.png */,
+ 73A8F7D1163B05C300C35E58 /* Default.png */,
+ 73A8F7D2163B05C300C35E58 /* Default@2x.png */,
+ );
+ name = KGDiscreteAlertViewExample;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 737C8D451638BED10066F127 /* KGDiscreteAlertViewExample */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 737C8D641638BED10066F127 /* Build configuration list for PBXNativeTarget "KGDiscreteAlertViewExample" */;
+ buildPhases = (
+ 737C8D421638BED10066F127 /* Sources */,
+ 737C8D431638BED10066F127 /* Frameworks */,
+ 737C8D441638BED10066F127 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = KGDiscreteAlertViewExample;
+ productName = KGDiscreteAlertViewExample;
+ productReference = 737C8D461638BED10066F127 /* KGDiscreteAlertViewExample.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 737C8D3D1638BED10066F127 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ CLASSPREFIX = KG;
+ LastUpgradeCheck = 0450;
+ ORGANIZATIONNAME = "David Keegan";
+ };
+ buildConfigurationList = 737C8D401638BED10066F127 /* Build configuration list for PBXProject "KGDiscreteAlertViewExample" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ );
+ mainGroup = 737C8D3B1638BED10066F127;
+ productRefGroup = 737C8D471638BED10066F127 /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 737C8D451638BED10066F127 /* KGDiscreteAlertViewExample */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 737C8D441638BED10066F127 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 73A8F7DA163B05C300C35E58 /* Default-568h@2x.png in Resources */,
+ 73A8F7DB163B05C300C35E58 /* Default.png in Resources */,
+ 73A8F7DC163B05C300C35E58 /* Default@2x.png in Resources */,
+ 73A8F7E9163B084D00C35E58 /* KGViewController.xib in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 737C8D421638BED10066F127 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 7308BB9D1638BFB600C8DCDE /* KGDiscreteAlertView.m in Sources */,
+ 73A8F7DD163B05C300C35E58 /* KGAppDelegate.m in Sources */,
+ 73A8F7DF163B05C300C35E58 /* main.m in Sources */,
+ 73A8F7E8163B084D00C35E58 /* KGViewController.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ 737C8D621638BED10066F127 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 6.0;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = iphoneos;
+ };
+ name = Debug;
+ };
+ 737C8D631638BED10066F127 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 6.0;
+ OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
+ SDKROOT = iphoneos;
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ 737C8D651638BED10066F127 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ INFOPLIST_FILE = "KGDiscreteAlertViewExample-Info.plist";
+ IPHONEOS_DEPLOYMENT_TARGET = 5.0;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ TARGETED_DEVICE_FAMILY = "1,2";
+ WRAPPER_EXTENSION = app;
+ };
+ name = Debug;
+ };
+ 737C8D661638BED10066F127 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ INFOPLIST_FILE = "KGDiscreteAlertViewExample-Info.plist";
+ IPHONEOS_DEPLOYMENT_TARGET = 5.0;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ TARGETED_DEVICE_FAMILY = "1,2";
+ WRAPPER_EXTENSION = app;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 737C8D401638BED10066F127 /* Build configuration list for PBXProject "KGDiscreteAlertViewExample" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 737C8D621638BED10066F127 /* Debug */,
+ 737C8D631638BED10066F127 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 737C8D641638BED10066F127 /* Build configuration list for PBXNativeTarget "KGDiscreteAlertViewExample" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 737C8D651638BED10066F127 /* Debug */,
+ 737C8D661638BED10066F127 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 737C8D3D1638BED10066F127 /* Project object */;
+}
7 Example/KGDiscreteAlertViewExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:KGDiscreteAlertViewExample.xcodeproj">
+ </FileRef>
+</Workspace>
15 Example/KGViewController.h
@@ -0,0 +1,15 @@
+//
+// KGViewController.h
+// KGDiscreteAlertViewExample
+//
+// Created by David Keegan on 10/26/12.
+// Copyright (c) 2012 David Keegan. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface KGViewController : UIViewController
+- (IBAction)alert1:(id)sender;
+- (IBAction)alert2:(id)sender;
+- (IBAction)alert3:(id)sender;
+@end
43 Example/KGViewController.m
@@ -0,0 +1,43 @@
+//
+// KGViewController.m
+// KGDiscreteAlertViewExample
+//
+// Created by David Keegan on 10/26/12.
+// Copyright (c) 2012 David Keegan. All rights reserved.
+//
+
+#import "KGViewController.h"
+#import "KGDiscreteAlertView.h"
+
+@interface KGViewController()
+@property (weak, nonatomic) KGDiscreteAlertView *alert2;
+@property (weak, nonatomic) KGDiscreteAlertView *alert3;
+@end
+
+@implementation KGViewController
+
+- (IBAction)alert1:(id)sender{
+ [self.alert2 hide];
+ [self.alert3 hide];
+ [KGDiscreteAlertView showDiscreteAlertWithText:@"KGDiscreteAlertView, add discrete alerts to any view!"
+ inView:self.view];
+}
+
+- (IBAction)alert2:(id)sender{
+ [self.alert3 hide];
+ self.alert2 =
+ [KGDiscreteAlertView showDiscreteAlertWithText:@"Even multiline messages just...\n\nwork!"
+ inView:self.view];
+}
+
+- (IBAction)alert3:(id)sender{
+ [self.alert2 hide];
+ self.alert3 =
+ [KGDiscreteAlertView showDiscreteAlertWithText:@"The old lady pulled her spectacles down and looked "
+ "over them about the room; then she put them up and looked out under them. She seldom or never looked "
+ "THROUGH them for so small a thing as a boy; they were her state pair, the pride of her heart, and were "
+ "built for \"style,\" not service -- she could have seen through a pair of stove-lids just as well. "
+ inView:self.view maxWidth:500 delay:0];
+}
+
+@end
517 Example/KGViewController.xib
@@ -0,0 +1,517 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
+ <data>
+ <int key="IBDocument.SystemTarget">1536</int>
+ <string key="IBDocument.SystemVersion">12C60</string>
+ <string key="IBDocument.InterfaceBuilderVersion">2843</string>
+ <string key="IBDocument.AppKitVersion">1187.34</string>
+ <string key="IBDocument.HIToolboxVersion">625.00</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="NS.object.0">1929</string>
+ </object>
+ <array key="IBDocument.IntegratedClassDependencies">
+ <string>IBNSLayoutConstraint</string>
+ <string>IBProxyObject</string>
+ <string>IBUIButton</string>
+ <string>IBUIView</string>
+ </array>
+ <array key="IBDocument.PluginDependencies">
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </array>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
+ <integer value="1" key="NS.object.0"/>
+ </object>
+ <array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <object class="IBProxyObject" id="372490531">
+ <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBProxyObject" id="975951072">
+ <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBUIView" id="191373211">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">274</int>
+ <array class="NSMutableArray" key="NSSubviews">
+ <object class="IBUIButton" id="375033803">
+ <reference key="NSNextResponder" ref="191373211"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{70, 201}, {180, 44}}</string>
+ <reference key="NSSuperview" ref="191373211"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="493607435"/>
+ <string key="NSReuseIdentifierKey">_NS:9</string>
+ <bool key="IBUIOpaque">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <int key="IBUIContentHorizontalAlignment">0</int>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <int key="IBUIButtonType">1</int>
+ <string key="IBUINormalTitle">Alert 1</string>
+ <object class="NSColor" key="IBUIHighlightedTitleColor" id="67328105">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MQA</bytes>
+ </object>
+ <object class="NSColor" key="IBUINormalTitleColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
+ </object>
+ <object class="NSColor" key="IBUINormalTitleShadowColor" id="497133749">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC41AA</bytes>
+ </object>
+ <object class="IBUIFontDescription" key="IBUIFontDescription" id="239993645">
+ <int key="type">2</int>
+ <double key="pointSize">15</double>
+ </object>
+ <object class="NSFont" key="IBUIFont" id="135955874">
+ <string key="NSName">Helvetica-Bold</string>
+ <double key="NSSize">15</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ </object>
+ <object class="IBUIButton" id="493607435">
+ <reference key="NSNextResponder" ref="191373211"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{70, 252}, {180, 44}}</string>
+ <reference key="NSSuperview" ref="191373211"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="166519597"/>
+ <string key="NSReuseIdentifierKey">_NS:9</string>
+ <bool key="IBUIOpaque">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <int key="IBUIContentHorizontalAlignment">0</int>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <int key="IBUIButtonType">1</int>
+ <string key="IBUINormalTitle">Alert 2</string>
+ <reference key="IBUIHighlightedTitleColor" ref="67328105"/>
+ <object class="NSColor" key="IBUINormalTitleColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
+ </object>
+ <reference key="IBUINormalTitleShadowColor" ref="497133749"/>
+ <reference key="IBUIFontDescription" ref="239993645"/>
+ <reference key="IBUIFont" ref="135955874"/>
+ </object>
+ <object class="IBUIButton" id="166519597">
+ <reference key="NSNextResponder" ref="191373211"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{70, 303}, {180, 44}}</string>
+ <reference key="NSSuperview" ref="191373211"/>
+ <reference key="NSWindow"/>
+ <string key="NSReuseIdentifierKey">_NS:9</string>
+ <bool key="IBUIOpaque">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <int key="IBUIContentHorizontalAlignment">0</int>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <int key="IBUIButtonType">1</int>
+ <string key="IBUINormalTitle">Alert 3</string>
+ <reference key="IBUIHighlightedTitleColor" ref="67328105"/>
+ <object class="NSColor" key="IBUINormalTitleColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
+ </object>
+ <reference key="IBUINormalTitleShadowColor" ref="497133749"/>
+ <reference key="IBUIFontDescription" ref="239993645"/>
+ <reference key="IBUIFont" ref="135955874"/>
+ </object>
+ </array>
+ <string key="NSFrame">{{0, 20}, {320, 548}}</string>
+ <reference key="NSSuperview"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="375033803"/>
+ <object class="NSColor" key="IBUIBackgroundColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MQA</bytes>
+ <object class="NSColorSpace" key="NSCustomColorSpace">
+ <int key="NSID">2</int>
+ </object>
+ </object>
+ <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
+ <object class="IBUIScreenMetrics" key="IBUISimulatedDestinationMetrics">
+ <string key="IBUISimulatedSizeMetricsClass">IBUIScreenMetrics</string>
+ <object class="NSMutableDictionary" key="IBUINormalizedOrientationToSizeMap">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <array key="dict.sortedKeys">
+ <integer value="1"/>
+ <integer value="3"/>
+ </array>
+ <array key="dict.values">
+ <string>{320, 568}</string>
+ <string>{568, 320}</string>
+ </array>
+ </object>
+ <string key="IBUITargetRuntime">IBCocoaTouchFramework</string>
+ <string key="IBUIDisplayName">Retina 4 Full Screen</string>
+ <int key="IBUIType">2</int>
+ </object>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ </array>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <array class="NSMutableArray" key="connectionRecords">
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">view</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="191373211"/>
+ </object>
+ <int key="connectionID">3</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchEventConnection" key="connection">
+ <string key="label">alert1:</string>
+ <reference key="source" ref="375033803"/>
+ <reference key="destination" ref="372490531"/>
+ <int key="IBEventType">7</int>
+ </object>
+ <int key="connectionID">31</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchEventConnection" key="connection">
+ <string key="label">alert2:</string>
+ <reference key="source" ref="493607435"/>
+ <reference key="destination" ref="372490531"/>
+ <int key="IBEventType">7</int>
+ </object>
+ <int key="connectionID">32</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchEventConnection" key="connection">
+ <string key="label">alert3:</string>
+ <reference key="source" ref="166519597"/>
+ <reference key="destination" ref="372490531"/>
+ <int key="IBEventType">7</int>
+ </object>
+ <int key="connectionID">33</int>
+ </object>
+ </array>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <array key="orderedObjects">
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <array key="object" id="0"/>
+ <reference key="children" ref="1000"/>
+ <nil key="parent"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1</int>
+ <reference key="object" ref="191373211"/>
+ <array class="NSMutableArray" key="children">
+ <object class="IBNSLayoutConstraint" id="533979845">
+ <reference key="firstItem" ref="166519597"/>
+ <int key="firstAttribute">3</int>
+ <int key="relation">0</int>
+ <reference key="secondItem" ref="493607435"/>
+ <int key="secondAttribute">4</int>
+ <float key="multiplier">1</float>
+ <object class="IBNSLayoutSymbolicConstant" key="constant">
+ <double key="value">8</double>
+ </object>
+ <float key="priority">1000</float>
+ <reference key="containingView" ref="191373211"/>
+ <int key="scoringType">6</int>
+ <float key="scoringTypeFloat">24</float>
+ <int key="contentType">3</int>
+ </object>
+ <object class="IBNSLayoutConstraint" id="527045128">
+ <reference key="firstItem" ref="166519597"/>
+ <int key="firstAttribute">6</int>
+ <int key="relation">0</int>
+ <reference key="secondItem" ref="493607435"/>
+ <int key="secondAttribute">6</int>
+ <float key="multiplier">1</float>
+ <object class="IBLayoutConstant" key="constant">
+ <double key="value">0.0</double>
+ </object>
+ <float key="priority">1000</float>
+ <reference key="containingView" ref="191373211"/>
+ <int key="scoringType">6</int>
+ <float key="scoringTypeFloat">24</float>
+ <int key="contentType">2</int>
+ </object>
+ <object class="IBNSLayoutConstraint" id="1069175286">
+ <reference key="firstItem" ref="166519597"/>
+ <int key="firstAttribute">5</int>
+ <int key="relation">0</int>
+ <reference key="secondItem" ref="493607435"/>
+ <int key="secondAttribute">5</int>
+ <float key="multiplier">1</float>
+ <object class="IBLayoutConstant" key="constant">
+ <double key="value">0.0</double>
+ </object>
+ <float key="priority">1000</float>
+ <reference key="containingView" ref="191373211"/>
+ <int key="scoringType">6</int>
+ <float key="scoringTypeFloat">24</float>
+ <int key="contentType">2</int>
+ </object>
+ <object class="IBNSLayoutConstraint" id="502395528">
+ <reference key="firstItem" ref="493607435"/>
+ <int key="firstAttribute">3</int>
+ <int key="relation">0</int>
+ <reference key="secondItem" ref="375033803"/>
+ <int key="secondAttribute">4</int>
+ <float key="multiplier">1</float>
+ <object class="IBNSLayoutSymbolicConstant" key="constant">
+ <double key="value">8</double>
+ </object>
+ <float key="priority">1000</float>
+ <reference key="containingView" ref="191373211"/>
+ <int key="scoringType">6</int>
+ <float key="scoringTypeFloat">24</float>
+ <int key="contentType">3</int>
+ </object>
+ <object class="IBNSLayoutConstraint" id="15223595">
+ <reference key="firstItem" ref="493607435"/>
+ <int key="firstAttribute">5</int>
+ <int key="relation">0</int>
+ <reference key="secondItem" ref="375033803"/>
+ <int key="secondAttribute">5</int>
+ <float key="multiplier">1</float>
+ <object class="IBLayoutConstant" key="constant">
+ <double key="value">0.0</double>
+ </object>
+ <float key="priority">1000</float>
+ <reference key="containingView" ref="191373211"/>
+ <int key="scoringType">6</int>
+ <float key="scoringTypeFloat">24</float>
+ <int key="contentType">2</int>
+ </object>
+ <object class="IBNSLayoutConstraint" id="348566330">
+ <reference key="firstItem" ref="493607435"/>
+ <int key="firstAttribute">6</int>
+ <int key="relation">0</int>
+ <reference key="secondItem" ref="375033803"/>
+ <int key="secondAttribute">6</int>
+ <float key="multiplier">1</float>
+ <object class="IBLayoutConstant" key="constant">
+ <double key="value">0.0</double>
+ </object>
+ <float key="priority">1000</float>
+ <reference key="containingView" ref="191373211"/>
+ <int key="scoringType">6</int>
+ <float key="scoringTypeFloat">24</float>
+ <int key="contentType">2</int>
+ </object>
+ <object class="IBNSLayoutConstraint" id="394946790">
+ <reference key="firstItem" ref="375033803"/>
+ <int key="firstAttribute">9</int>
+ <int key="relation">0</int>
+ <reference key="secondItem" ref="191373211"/>
+ <int key="secondAttribute">9</int>
+ <float key="multiplier">1</float>
+ <object class="IBLayoutConstant" key="constant">
+ <double key="value">0.0</double>
+ </object>
+ <float key="priority">1000</float>
+ <reference key="containingView" ref="191373211"/>
+ <int key="scoringType">5</int>
+ <float key="scoringTypeFloat">22</float>
+ <int key="contentType">2</int>
+ </object>
+ <object class="IBNSLayoutConstraint" id="854875199">
+ <reference key="firstItem" ref="375033803"/>
+ <int key="firstAttribute">3</int>
+ <int key="relation">0</int>
+ <reference key="secondItem" ref="191373211"/>
+ <int key="secondAttribute">3</int>
+ <float key="multiplier">1</float>
+ <object class="IBLayoutConstant" key="constant">
+ <double key="value">201</double>
+ </object>
+ <float key="priority">1000</float>
+ <reference key="containingView" ref="191373211"/>
+ <int key="scoringType">3</int>
+ <float key="scoringTypeFloat">9</float>
+ <int key="contentType">3</int>
+ </object>
+ <reference ref="375033803"/>
+ <reference ref="493607435"/>
+ <reference ref="166519597"/>
+ </array>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-1</int>
+ <reference key="object" ref="372490531"/>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">File's Owner</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-2</int>
+ <reference key="object" ref="975951072"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">4</int>
+ <reference key="object" ref="375033803"/>
+ <array class="NSMutableArray" key="children">
+ <object class="IBNSLayoutConstraint" id="608011403">
+ <reference key="firstItem" ref="375033803"/>
+ <int key="firstAttribute">7</int>
+ <int key="relation">0</int>
+ <nil key="secondItem"/>
+ <int key="secondAttribute">0</int>
+ <float key="multiplier">1</float>
+ <object class="IBLayoutConstant" key="constant">
+ <double key="value">180</double>
+ </object>
+ <float key="priority">1000</float>
+ <reference key="containingView" ref="375033803"/>
+ <int key="scoringType">3</int>
+ <float key="scoringTypeFloat">9</float>
+ <int key="contentType">1</int>
+ </object>
+ </array>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">9</int>
+ <reference key="object" ref="608011403"/>
+ <reference key="parent" ref="375033803"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">12</int>
+ <reference key="object" ref="493607435"/>
+ <array class="NSMutableArray" key="children"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">17</int>
+ <reference key="object" ref="348566330"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">18</int>
+ <reference key="object" ref="15223595"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">19</int>
+ <reference key="object" ref="502395528"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">21</int>
+ <reference key="object" ref="166519597"/>
+ <array class="NSMutableArray" key="children"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">25</int>
+ <reference key="object" ref="1069175286"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">27</int>
+ <reference key="object" ref="527045128"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">28</int>
+ <reference key="object" ref="533979845"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">29</int>
+ <reference key="object" ref="854875199"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">30</int>
+ <reference key="object" ref="394946790"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ </array>
+ </object>
+ <dictionary class="NSMutableDictionary" key="flattenedProperties">
+ <string key="-1.CustomClassName">KGViewController</string>
+ <string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="-2.CustomClassName">UIResponder</string>
+ <string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <array class="NSMutableArray" key="1.IBViewMetadataConstraints">
+ <reference ref="854875199"/>
+ <reference ref="394946790"/>
+ <reference ref="348566330"/>
+ <reference ref="15223595"/>
+ <reference ref="502395528"/>
+ <reference ref="1069175286"/>
+ <reference ref="527045128"/>
+ <reference ref="533979845"/>
+ </array>
+ <string key="12.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <boolean value="NO" key="12.IBViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
+ <string key="17.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="18.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="19.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="21.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <boolean value="NO" key="21.IBViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
+ <string key="25.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="27.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="28.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="29.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="30.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <array class="NSMutableArray" key="4.IBViewMetadataConstraints">
+ <reference ref="608011403"/>
+ </array>
+ <boolean value="NO" key="4.IBViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
+ <string key="9.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </dictionary>
+ <dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
+ <nil key="activeLocalization"/>
+ <dictionary class="NSMutableDictionary" key="localizations"/>
+ <nil key="sourceID"/>
+ <int key="maxID">33</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <array class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <object class="IBPartialClassDescription">
+ <string key="className">KGViewController</string>
+ <string key="superclassName">UIViewController</string>
+ <dictionary class="NSMutableDictionary" key="actions">
+ <string key="alert1:">id</string>
+ <string key="alert2:">id</string>
+ <string key="alert3:">id</string>
+ </dictionary>
+ <dictionary class="NSMutableDictionary" key="actionInfosByName">
+ <object class="IBActionInfo" key="alert1:">
+ <string key="name">alert1:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="alert2:">
+ <string key="name">alert2:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="alert3:">
+ <string key="name">alert3:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ </dictionary>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./Classes/KGViewController.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSLayoutConstraint</string>
+ <string key="superclassName">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./Classes/NSLayoutConstraint.h</string>
+ </object>
+ </object>
+ </array>
+ </object>
+ <int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <bool key="IBDocument.UseAutolayout">YES</bool>
+ <string key="IBCocoaTouchPluginVersion">1929</string>
+ </data>
+</archive>
17 Example/main.m
@@ -0,0 +1,17 @@
+//
+// main.m
+// KGDiscreteAlertViewExample
+//
+// Created by David Keegan on 10/24/12.
+// Copyright (c) 2012 David Keegan. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+#import "KGAppDelegate.h"
+
+int main(int argc, char *argv[]){
+ @autoreleasepool{
+ return UIApplicationMain(argc, argv, nil, NSStringFromClass([KGAppDelegate class]));
+ }
+}
48 KGDiscreteAlertView.h
@@ -0,0 +1,48 @@
+//
+// KGDiscreteAlertView.h
+// KGDiscreteAlertView
+//
+// Created by David Keegan on 9/11/12.
+// Copyright (c) 2012 David Keegan. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface KGDiscreteAlertView : UIView
+
+#pragma mark - Convenience Class Methods
+
+// Show a discrete alert with the given text in a view,
+// the alert will be automatically dismissed after 3 seconds
++ (id)showDiscreteAlertWithText:(NSString *)text inView:(UIView *)view;
+
+// Show a discrete alert with the given text in a view,
+// the alert will be automatically dismissed after the specified delay.
+// If the delay is 0 the alert will be 'sticky' and will not be dismissed until `hide` is called.
++ (id)showDiscreteAlertWithText:(NSString *)text inView:(UIView *)view delay:(NSTimeInterval)delay;
+
+// Show a discrete alert with the given text in a view, and a max width for the alert.
+// The alert will be automaticly dismissed after the specified delay,
+// if the delay is 0 the alert will be 'sticky' and will not be dismissed until `hide` is called.
++ (id)showDiscreteAlertWithText:(NSString *)text inView:(UIView *)view maxWidth:(CGFloat)maxWidth delay:(NSTimeInterval)delay;
+
+#pragma mark - Instance Methods
+
+// Show a discrete alert with the given text in a view,
+// the alert will be automatically dismissed after 3 seconds
+- (void)showWithText:(NSString *)text inView:(UIView *)view;
+
+// Show a discrete alert with the given text in a view,
+// the alert will be automatically dismissed after the specified delay.
+// If the delay is 0 the alert will be 'sticky' and will not be dismissed until `hide` is called.
+- (void)showWithText:(NSString *)text inView:(UIView *)view delay:(NSTimeInterval)delay;
+
+// Show a discrete alert with the given text in a view, and a max width for the alert.
+// The alert will be automatically dismissed after the specified delay,
+// if the delay is 0 the alert will be 'sticky' and will not be dismissed until `hide` is called.
+- (void)showWithText:(NSString *)text inView:(UIView *)view maxWidth:(CGFloat)maxWidth delay:(NSTimeInterval)delay;
+
+// Dismiss the discrete alert.
+- (void)hide;
+
+@end
151 KGDiscreteAlertView.m
@@ -0,0 +1,151 @@
+//
+// KGDiscreteAlertView.m
+// KGDiscreteAlertView
+//
+// Created by David Keegan on 9/11/12.
+// Copyright (c) 2012 David Keegan. All rights reserved.
+//
+
+#import "KGDiscreteAlertView.h"
+
+static CGFloat const kPadding = 12;
+static NSTimeInterval const kAnimation = 0.25;
+static NSTimeInterval const kDelay = 3;
+
+@interface KGDiscreteAlertView()
+@property (weak, nonatomic) UILabel *label;
+@property (nonatomic) BOOL willHide;
+@end
+
+@implementation KGDiscreteAlertView
+
+- (id)init{
+ if(self = [super init]){
+ UILabel *label = self.label = [[UILabel alloc] init];
+ label.lineBreakMode = UILineBreakModeWordWrap;
+ label.backgroundColor = [UIColor clearColor];
+ label.textAlignment = UITextAlignmentCenter;
+ label.textColor = [UIColor whiteColor];
+ label.shadowColor = [UIColor colorWithWhite:0 alpha:0.5];
+ label.shadowOffset = CGSizeMake(0, 1);
+ [self addSubview:label];
+ self.opaque = NO;
+ }
+ return self;
+}
+
+- (void)sizeLabel:(UILabel *)label toFitTextWithWidth:(CGFloat)width{
+ CGSize textSize =
+ [label.text sizeWithFont:label.font
+ constrainedToSize:CGSizeMake(width, MAXFLOAT)
+ lineBreakMode:label.lineBreakMode];
+ label.numberOfLines = ceil(textSize.height/label.font.lineHeight);
+ CGRect frame = label.frame;
+ frame.size = textSize;
+ label.frame = frame;
+}
+
++ (id)showDiscreteAlertWithText:(NSString *)text inView:(UIView *)view{
+ return [self showDiscreteAlertWithText:text inView:view delay:kDelay];
+}
+
++ (id)showDiscreteAlertWithText:(NSString *)text inView:(UIView *)view delay:(NSTimeInterval)delay{
+ return [self showDiscreteAlertWithText:text inView:view maxWidth:MAXFLOAT delay:delay];
+}
+
++ (id)showDiscreteAlertWithText:(NSString *)text inView:(UIView *)view maxWidth:(CGFloat)maxWidth delay:(NSTimeInterval)delay{
+ id discreteAlertView = [[[self class] alloc] init];
+ [discreteAlertView showWithText:text inView:view maxWidth:maxWidth delay:delay];
+ return discreteAlertView;
+}
+
+- (void)showWithText:(NSString *)text inView:(UIView *)view{
+ [self showWithText:text inView:view delay:kDelay];
+}
+
+- (void)showWithText:(NSString *)text inView:(UIView *)view delay:(NSTimeInterval)delay{
+ [self showWithText:text inView:view maxWidth:MAXFLOAT delay:delay];
+}
+
+- (void)showWithText:(NSString *)text inView:(UIView *)view maxWidth:(CGFloat)maxWidth delay:(NSTimeInterval)delay{
+ // make sure there isn't already a KGDiscreteAlertView in the view that is not being hidden
+ for(UIView *subview in view.subviews){
+ if([subview isKindOfClass:[KGDiscreteAlertView class]] &&
+ ![(KGDiscreteAlertView *)subview willHide]){
+ return;
+ }
+ }
+
+ self.label.text = text;
+ [self sizeLabel:self.label toFitTextWithWidth:MIN(maxWidth, CGRectGetWidth(view.bounds)-kPadding*2)];
+
+ __block CGRect selfFrame = self.label.bounds;
+ selfFrame.size.width += kPadding*2;
+ selfFrame.size.height += 4;
+
+ CGRect labelRect = self.label.bounds;
+ labelRect.origin.x = round(CGRectGetMidX(selfFrame)-CGRectGetMidX(labelRect));
+ labelRect.origin.y = round(CGRectGetMidY(selfFrame)-CGRectGetMidY(labelRect));
+
+ selfFrame.origin.y = -CGRectGetHeight(selfFrame);
+ selfFrame.origin.x = round(CGRectGetMidX(view.bounds)-CGRectGetMidX(selfFrame));
+
+ self.frame = selfFrame;
+ self.label.frame = labelRect;
+
+ [view addSubview:self];
+
+ [UIView animateWithDuration:kAnimation animations:^{
+ selfFrame.origin.y = 0;
+ self.frame = selfFrame;
+ } completion:^(BOOL finished){
+ if(delay > 0){
+ [NSTimer scheduledTimerWithTimeInterval:kDelay target:self selector:@selector(hide) userInfo:nil repeats:NO];
+ }
+ }];
+}
+
+- (void)hide{
+ self.willHide = YES;
+ [UIView animateWithDuration:kAnimation animations:^{
+ CGRect frame = self.frame;
+ frame.origin.y = -CGRectGetHeight(frame);
+ self.frame = frame;
+ } completion:^(BOOL finished){
+ [self removeFromSuperview];
+ }];
+}
+
+- (void)drawRect:(CGRect)rect{
+ //// Color Declarations
+ UIColor* color = [UIColor colorWithRed: 0 green: 0 blue: 0 alpha: 0.8];
+
+ //// Frames
+ CGRect mainFrame = self.bounds;
+
+ //// Subframes
+ CGRect frame = CGRectMake(CGRectGetMinX(mainFrame) + -1, CGRectGetMinY(mainFrame) + -1, 11, 9);
+ CGRect frame2 = CGRectMake(CGRectGetMinX(mainFrame) + CGRectGetWidth(mainFrame) - 12, CGRectGetMinY(mainFrame) + -1, 14, 8);
+ CGRect frame3 = CGRectMake(CGRectGetMinX(mainFrame) + 4, CGRectGetMinY(mainFrame) + CGRectGetHeight(mainFrame) - 6, 8, 7);
+ CGRect frame4 = CGRectMake(CGRectGetMinX(mainFrame) + CGRectGetWidth(mainFrame) - 13, CGRectGetMinY(mainFrame) + CGRectGetHeight(mainFrame) - 6, 10, 7);
+
+
+ //// Bezier 2 Drawing
+ UIBezierPath* bezier2Path = [UIBezierPath bezierPath];
+ [bezier2Path moveToPoint: CGPointMake(CGRectGetMinX(frame2) + 0.5 * CGRectGetWidth(frame2), CGRectGetMinY(frame2) + 0.75 * CGRectGetHeight(frame2))];
+ [bezier2Path addLineToPoint: CGPointMake(CGRectGetMinX(frame4) + 0.8 * CGRectGetWidth(frame4), CGRectGetMinY(frame4) + 0.29 * CGRectGetHeight(frame4))];
+ [bezier2Path addCurveToPoint: CGPointMake(CGRectGetMinX(frame4) + 0.4 * CGRectGetWidth(frame4), CGRectGetMinY(frame4) + 0.86 * CGRectGetHeight(frame4)) controlPoint1: CGPointMake(CGRectGetMinX(frame4) + 0.8 * CGRectGetWidth(frame4), CGRectGetMinY(frame4) + 0.6 * CGRectGetHeight(frame4)) controlPoint2: CGPointMake(CGRectGetMinX(frame4) + 0.62 * CGRectGetWidth(frame4), CGRectGetMinY(frame4) + 0.86 * CGRectGetHeight(frame4))];
+ [bezier2Path addLineToPoint: CGPointMake(CGRectGetMinX(frame3) + 0.62 * CGRectGetWidth(frame3), CGRectGetMinY(frame3) + 0.86 * CGRectGetHeight(frame3))];
+ [bezier2Path addCurveToPoint: CGPointMake(CGRectGetMinX(frame3) + 0.12 * CGRectGetWidth(frame3), CGRectGetMinY(frame3) + 0.29 * CGRectGetHeight(frame3)) controlPoint1: CGPointMake(CGRectGetMinX(frame3) + 0.35 * CGRectGetWidth(frame3), CGRectGetMinY(frame3) + 0.86 * CGRectGetHeight(frame3)) controlPoint2: CGPointMake(CGRectGetMinX(frame3) + 0.12 * CGRectGetWidth(frame3), CGRectGetMinY(frame3) + 0.6 * CGRectGetHeight(frame3))];
+ [bezier2Path addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.55 * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.67 * CGRectGetHeight(frame))];
+ [bezier2Path addCurveToPoint: CGPointMake(CGRectGetMinX(frame) + 0.09 * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.11 * CGRectGetHeight(frame)) controlPoint1: CGPointMake(CGRectGetMinX(frame) + 0.55 * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.36 * CGRectGetHeight(frame)) controlPoint2: CGPointMake(CGRectGetMinX(frame) + 0.34 * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.11 * CGRectGetHeight(frame))];
+ [bezier2Path addLineToPoint: CGPointMake(CGRectGetMinX(frame2) + 0.86 * CGRectGetWidth(frame2), CGRectGetMinY(frame2) + 0.12 * CGRectGetHeight(frame2))];
+ [bezier2Path addCurveToPoint: CGPointMake(CGRectGetMinX(frame2) + 0.5 * CGRectGetWidth(frame2), CGRectGetMinY(frame2) + 0.75 * CGRectGetHeight(frame2)) controlPoint1: CGPointMake(CGRectGetMinX(frame2) + 0.66 * CGRectGetWidth(frame2), CGRectGetMinY(frame2) + 0.12 * CGRectGetHeight(frame2)) controlPoint2: CGPointMake(CGRectGetMinX(frame2) + 0.5 * CGRectGetWidth(frame2), CGRectGetMinY(frame2) + 0.4 * CGRectGetHeight(frame2))];
+ [bezier2Path closePath];
+ [color setFill];
+ [bezier2Path fill];
+
+ [super drawRect:rect];
+}
+
+@end
BIN  example.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 license.txt
@@ -0,0 +1,7 @@
+Copyright (c) 2012 David Keegan (http://davidkeegan.com)
+
+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.
50 readme.md
@@ -0,0 +1,50 @@
+`KGDiscreteAlertView` is an easy drop in control that allows you to display a discrete alert in any view.
+
+![](https://raw.github.com/kgn/KGDiscreteAlertView/master/example.gif)
+
+You supply your own text and `KGDiscreteAlertView` does the rest to properly fit the text in the discrete alert and animate it down from the top of the specified view:
+
+``` obj-c
+[KGDiscreteAlertView showDiscreteAlertWithText:@"KGDiscreteAlertView, add discrete alerts to any view!" inView:self.view];
+```
+
+There are a couple other options but it's purposely designed to be simple and easy to use:
+
+``` obj-c
+#pragma mark - Convenience Class Methods
+
+// Show a discrete alert with the given text in a view,
+// the alert will be automatically dismissed after 3 seconds
++ (id)showDiscreteAlertWithText:(NSString *)text inView:(UIView *)view;
+
+// Show a discrete alert with the given text in a view,
+// the alert will be automatically dismissed after the specified delay.
+// If the delay is 0 the alert will be 'sticky' and will not be dismissed until `hide` is called.
++ (id)showDiscreteAlertWithText:(NSString *)text inView:(UIView *)view delay:(NSTimeInterval)delay;
+
+// Show a discrete alert with the given text in a view, and a max width for the alert.
+// The alert will be automatically dismissed after the specified delay,
+// if the delay is 0 the alert will be 'sticky' and will not be dismissed until `hide` is called.
++ (id)showDiscreteAlertWithText:(NSString *)text inView:(UIView *)view maxWidth:(CGFloat)maxWidth delay:(NSTimeInterval)delay;
+
+#pragma mark - Instance Methods
+
+// Show a discrete alert with the given text in a view,
+// the alert will be automatically dismissed after 3 seconds
+- (void)showWithText:(NSString *)text inView:(UIView *)view;
+
+// Show a discrete alert with the given text in a view,
+// the alert will be automatically dismissed after the specified delay.
+// If the delay is 0 the alert will be 'sticky' and will not be dismissed until `hide` is called.
+- (void)showWithText:(NSString *)text inView:(UIView *)view delay:(NSTimeInterval)delay;
+
+// Show a discrete alert with the given text in a view, and a max width for the alert.
+// The alert will be automatically dismissed after the specified delay,
+// if the delay is 0 the alert will be 'sticky' and will not be dismissed until `hide` is called.
+- (void)showWithText:(NSString *)text inView:(UIView *)view maxWidth:(CGFloat)maxWidth delay:(NSTimeInterval)delay;
+
+// Dismiss the discrete alert.
+- (void)hide;
+```
+
+Check out the ExampleApp to see it in action!
Please sign in to comment.
Something went wrong with that request. Please try again.