├── .gitignore ├── LICENSE.md ├── README.md ├── SIActionSheet.podspec ├── SIActionSheet ├── SIActionSheet.bundle │ ├── button-cancel-d.png │ ├── button-cancel-d@2x.png │ ├── button-cancel.png │ ├── button-cancel@2x.png │ ├── button-default-d.png │ ├── button-default-d@2x.png │ ├── button-default.png │ ├── button-default@2x.png │ ├── button-destructive-d.png │ ├── button-destructive-d@2x.png │ ├── button-destructive.png │ └── button-destructive@2x.png ├── SIActionSheet.h ├── SIActionSheet.m ├── SIPopoverBackgroundView.h ├── SIPopoverBackgroundView.m ├── UIWindow+SIUtils.h └── UIWindow+SIUtils.m └── SIActionSheetExample ├── Icon-72.png ├── Icon-72@2x.png ├── Icon.png ├── Icon@2x.png ├── SIActionSheetExample.xcodeproj └── project.pbxproj └── SIActionSheetExample ├── AppDelegate.h ├── AppDelegate.m ├── Default-568h@2x.png ├── Default.png ├── Default@2x.png ├── SIActionSheetExample-Info.plist ├── SIActionSheetExample-Prefix.pch ├── ViewController.h ├── ViewController.m ├── en.lproj ├── InfoPlist.strings ├── MainStoryboard_iPad.storyboard └── MainStoryboard_iPhone.storyboard └── main.m /.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 | *.xcworkspace 13 | !default.xcworkspace 14 | xcuserdata 15 | profile 16 | *.moved-aside 17 | DerivedData 18 | .idea/ 19 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Sumi Interactive 2 | 3 | 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: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | 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. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | SIActionSheet 2 | ============= 3 | 4 | An UIActionSheet replacement with block syntax and flat design. As seen in [Grid Diary](http://griddiaryapp.com/). 5 | 6 | ## FEATURES 7 | 8 | - use window to present 9 | - happy with rotation 10 | - block syntax 11 | 12 | ## HOW TO USE 13 | 14 | **Required:** iOS 6+, ARC 15 | 16 | 1. Add all files under `SIActionSheet/SIActionSheet` to your project 17 | 3. Add `#import "SIActionSheet.h"` before using it 18 | 19 | ## EXAMPLES 20 | 21 | coming soon. 22 | 23 | ## LICENSE 24 | 25 | SIActionSheet is available under the MIT license. See the LICENSE file for more info. -------------------------------------------------------------------------------- /SIActionSheet.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'SIActionSheet' 3 | s.version = '1.1' 4 | s.platform = :ios 5 | s.license = 'MIT' 6 | s.summary = 'An UIActionSheet replacement.' 7 | s.homepage = 'https://github.com/Sumi-Interactive/SIActionSheet' 8 | s.author = { 'Sumi Interactive' => 'developer@sumi-sumi.com' } 9 | s.source = { :git => 'https://github.com/Sumi-Interactive/SIActionSheet.git', 10 | :tag => '1.1' } 11 | 12 | s.description = 'An SIActionSheet replacement with block syntax.' 13 | 14 | s.requires_arc = true 15 | s.framework = 'QuartzCore' 16 | s.source_files = 'SIActionSheet/*.{h,m}' 17 | s.resources = 'SIActionSheet/SIActionSheet.bundle' 18 | end 19 | -------------------------------------------------------------------------------- /SIActionSheet/SIActionSheet.bundle/button-cancel-d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sumi-Interactive/SIActionSheet/f7b4c6f8e75c098988f7c8e654362293dfbfb89b/SIActionSheet/SIActionSheet.bundle/button-cancel-d.png -------------------------------------------------------------------------------- /SIActionSheet/SIActionSheet.bundle/button-cancel-d@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sumi-Interactive/SIActionSheet/f7b4c6f8e75c098988f7c8e654362293dfbfb89b/SIActionSheet/SIActionSheet.bundle/button-cancel-d@2x.png -------------------------------------------------------------------------------- /SIActionSheet/SIActionSheet.bundle/button-cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sumi-Interactive/SIActionSheet/f7b4c6f8e75c098988f7c8e654362293dfbfb89b/SIActionSheet/SIActionSheet.bundle/button-cancel.png -------------------------------------------------------------------------------- /SIActionSheet/SIActionSheet.bundle/button-cancel@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sumi-Interactive/SIActionSheet/f7b4c6f8e75c098988f7c8e654362293dfbfb89b/SIActionSheet/SIActionSheet.bundle/button-cancel@2x.png -------------------------------------------------------------------------------- /SIActionSheet/SIActionSheet.bundle/button-default-d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sumi-Interactive/SIActionSheet/f7b4c6f8e75c098988f7c8e654362293dfbfb89b/SIActionSheet/SIActionSheet.bundle/button-default-d.png -------------------------------------------------------------------------------- /SIActionSheet/SIActionSheet.bundle/button-default-d@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sumi-Interactive/SIActionSheet/f7b4c6f8e75c098988f7c8e654362293dfbfb89b/SIActionSheet/SIActionSheet.bundle/button-default-d@2x.png -------------------------------------------------------------------------------- /SIActionSheet/SIActionSheet.bundle/button-default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sumi-Interactive/SIActionSheet/f7b4c6f8e75c098988f7c8e654362293dfbfb89b/SIActionSheet/SIActionSheet.bundle/button-default.png -------------------------------------------------------------------------------- /SIActionSheet/SIActionSheet.bundle/button-default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sumi-Interactive/SIActionSheet/f7b4c6f8e75c098988f7c8e654362293dfbfb89b/SIActionSheet/SIActionSheet.bundle/button-default@2x.png -------------------------------------------------------------------------------- /SIActionSheet/SIActionSheet.bundle/button-destructive-d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sumi-Interactive/SIActionSheet/f7b4c6f8e75c098988f7c8e654362293dfbfb89b/SIActionSheet/SIActionSheet.bundle/button-destructive-d.png -------------------------------------------------------------------------------- /SIActionSheet/SIActionSheet.bundle/button-destructive-d@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sumi-Interactive/SIActionSheet/f7b4c6f8e75c098988f7c8e654362293dfbfb89b/SIActionSheet/SIActionSheet.bundle/button-destructive-d@2x.png -------------------------------------------------------------------------------- /SIActionSheet/SIActionSheet.bundle/button-destructive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sumi-Interactive/SIActionSheet/f7b4c6f8e75c098988f7c8e654362293dfbfb89b/SIActionSheet/SIActionSheet.bundle/button-destructive.png -------------------------------------------------------------------------------- /SIActionSheet/SIActionSheet.bundle/button-destructive@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sumi-Interactive/SIActionSheet/f7b4c6f8e75c098988f7c8e654362293dfbfb89b/SIActionSheet/SIActionSheet.bundle/button-destructive@2x.png -------------------------------------------------------------------------------- /SIActionSheet/SIActionSheet.h: -------------------------------------------------------------------------------- 1 | // 2 | // SIActionSheet.h 3 | // SIActionSheet 4 | // 5 | // Created by Kevin Cao on 13-05-26. 6 | // Copyright (c) 2012年 Sumi Interactive. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | extern NSString *const SIActionSheetWillShowNotification; 12 | extern NSString *const SIActionSheetDidShowNotification; 13 | extern NSString *const SIActionSheetWillDismissNotification; 14 | extern NSString *const SIActionSheetDidDismissNotification; 15 | 16 | extern NSString *const SIActionSheetDismissNotificationUserInfoButtonIndexKey; 17 | 18 | @class SIActionSheet; 19 | 20 | typedef NS_ENUM(NSInteger, SIActionSheetButtonType) { 21 | SIActionSheetButtonTypeDefault = 0, 22 | SIActionSheetButtonTypeDestructive, 23 | SIActionSheetButtonTypeCancel 24 | }; 25 | typedef void(^SIActionSheetShowHandler)(SIActionSheet *actionSheet); 26 | typedef void(^SIActionSheetDismissHandler)(SIActionSheet *actionSheet, NSInteger buttonIndex); 27 | 28 | @interface SIActionSheet : UIView 29 | 30 | @property (nonatomic, copy) NSString *title; 31 | @property (nonatomic, assign) BOOL allowTapBackgroundToDismiss; 32 | @property (nonatomic, assign, getter = isVisible) BOOL visible; 33 | 34 | @property (nonatomic, copy) SIActionSheetShowHandler willShowHandler; 35 | @property (nonatomic, copy) SIActionSheetShowHandler didShowHandler; 36 | @property (nonatomic, copy) SIActionSheetDismissHandler willDismissHandler; 37 | @property (nonatomic, copy) SIActionSheetDismissHandler didDismissHandler; 38 | 39 | @property (nonatomic, strong) UIColor *viewBackgroundColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; 40 | @property (nonatomic, strong) UIColor *titleColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; 41 | @property (nonatomic, strong) UIFont *titleFont NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; 42 | @property (nonatomic, strong) UIFont *buttonFont NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; 43 | @property (nonatomic, assign) CGFloat shadowOpacity NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; // default is 0.5 44 | 45 | - (id)initWithTitle:(NSString *)title; 46 | - (void)addButtonWithTitle:(NSString *)title type:(SIActionSheetButtonType)type handler:(SIActionSheetShowHandler)handler; 47 | 48 | - (void)show; 49 | - (void)showFromRect:(CGRect)rect inView:(UIView *)view; 50 | - (void)dismissWithButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated; // (buttonIndex == -1) means no button is clicked. 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /SIActionSheet/SIActionSheet.m: -------------------------------------------------------------------------------- 1 | // 2 | // SIActionSheet.m 3 | // SIActionSheet 4 | // 5 | // Created by Kevin Cao on 13-05-26. 6 | // Copyright (c) 2012年 Sumi Interactive. All rights reserved. 7 | // 8 | 9 | #import "SIActionSheet.h" 10 | #import "SIPopoverBackgroundView.h" 11 | #import "UIWindow+SIUtils.h" 12 | #import 13 | 14 | #define HEADER_HEIGHT 40 15 | #define ROW_HEIGHT 54 16 | #define VERTICAL_INSET 8 17 | #define HORIZONTAL_PADDING 10 18 | #define PADDING_TOP 10 19 | #define GAP 12 20 | #define TITLE_LINES_MAX 5 21 | 22 | NSString *const SIActionSheetWillShowNotification = @"SIActionSheetWillShowNotification"; 23 | NSString *const SIActionSheetDidShowNotification = @"SIActionSheetDidShowNotification"; 24 | NSString *const SIActionSheetWillDismissNotification = @"SIActionSheetWillDismissNotification"; 25 | NSString *const SIActionSheetDidDismissNotification = @"SIActionSheetDidDismissNotification"; 26 | 27 | NSString *const SIActionSheetDismissNotificationUserInfoButtonIndexKey = @"SIActionSheetDismissNotificationUserInfoButtonIndexKey"; 28 | 29 | @interface SIActionSheet () 30 | 31 | @property (nonatomic, strong) NSMutableArray *items; 32 | @property (nonatomic, strong) UIView *backgroundView; 33 | @property (nonatomic, strong) UIView *containerView; 34 | @property (nonatomic, strong) UILabel *titleLabel; 35 | @property (nonatomic, strong) UITableView *tableView; 36 | 37 | @property (nonatomic, strong) UIWindow *actionsheetWindow; 38 | @property (nonatomic, strong) UIWindow *oldKeyWindow; 39 | @property (nonatomic, strong) UIPopoverController *popoverController; 40 | #ifdef __IPHONE_7_0 41 | @property (nonatomic, assign) UIViewTintAdjustmentMode oldTintAdjustmentMode; 42 | #endif 43 | 44 | 45 | - (CGFloat)preferredHeight; 46 | 47 | @end 48 | 49 | @interface SIActionSheetItem : NSObject 50 | 51 | @property (nonatomic, copy) NSString *title; 52 | @property (nonatomic, assign) SIActionSheetButtonType type; 53 | @property (nonatomic, copy) SIActionSheetShowHandler action; 54 | 55 | @end 56 | 57 | @implementation SIActionSheetItem 58 | 59 | @end 60 | 61 | @interface SIActionSheetViewController : UIViewController 62 | 63 | @property (nonatomic, strong) SIActionSheet *actionSheet; 64 | 65 | @end 66 | 67 | @implementation SIActionSheetViewController 68 | 69 | - (void)loadView 70 | { 71 | self.view = self.actionSheet; 72 | } 73 | 74 | #ifdef __IPHONE_7_0 75 | - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration 76 | { 77 | if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) { 78 | [self setNeedsStatusBarAppearanceUpdate]; 79 | } 80 | } 81 | #endif 82 | 83 | - (NSUInteger)supportedInterfaceOrientations 84 | { 85 | UIViewController *viewController = [self.actionSheet.oldKeyWindow currentViewController]; 86 | if (viewController) { 87 | return [viewController supportedInterfaceOrientations]; 88 | } 89 | return UIInterfaceOrientationMaskAll; 90 | } 91 | 92 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation 93 | { 94 | UIViewController *viewController = [self.actionSheet.oldKeyWindow currentViewController]; 95 | if (viewController) { 96 | return [viewController shouldAutorotateToInterfaceOrientation:toInterfaceOrientation]; 97 | } 98 | return YES; 99 | } 100 | 101 | - (BOOL)shouldAutorotate 102 | { 103 | UIViewController *viewController = [self.actionSheet.oldKeyWindow currentViewController]; 104 | if (viewController) { 105 | return [viewController shouldAutorotate]; 106 | } 107 | return YES; 108 | } 109 | 110 | #ifdef __IPHONE_7_0 111 | - (UIStatusBarStyle)preferredStatusBarStyle 112 | { 113 | UIWindow *window = self.actionSheet.oldKeyWindow; 114 | if (!window) { 115 | window = [UIApplication sharedApplication].windows[0]; 116 | } 117 | return [[window viewControllerForStatusBarStyle] preferredStatusBarStyle]; 118 | } 119 | 120 | - (BOOL)prefersStatusBarHidden 121 | { 122 | UIWindow *window = self.actionSheet.oldKeyWindow; 123 | if (!window) { 124 | window = [UIApplication sharedApplication].windows[0]; 125 | } 126 | return [[window viewControllerForStatusBarHidden] prefersStatusBarHidden]; 127 | } 128 | #endif 129 | 130 | - (CGSize)contentSizeForViewInPopover 131 | { 132 | return [self preferredContentSize]; 133 | } 134 | 135 | - (CGSize)preferredContentSize 136 | { 137 | return CGSizeMake(320.0, [self.actionSheet preferredHeight] + 55); // TODO: replace hardcode value 138 | } 139 | 140 | @end 141 | 142 | @implementation SIActionSheet 143 | 144 | @synthesize viewBackgroundColor = _viewBackgroundColor; 145 | 146 | + (void)initialize 147 | { 148 | if (self != [SIActionSheet class]) 149 | return; 150 | 151 | SIActionSheet *appearance = [self appearance]; 152 | appearance.viewBackgroundColor = [UIColor whiteColor]; 153 | appearance.titleColor = [UIColor grayColor]; 154 | appearance.titleFont = [UIFont systemFontOfSize:16]; 155 | appearance.buttonFont = [UIFont systemFontOfSize:[UIFont buttonFontSize]]; 156 | appearance.shadowOpacity = 0.5; 157 | } 158 | 159 | - (id)init 160 | { 161 | return [self initWithTitle:nil]; 162 | } 163 | 164 | - (id)initWithTitle:(NSString *)title 165 | { 166 | self = [super init]; 167 | if (self) { 168 | _title = title; 169 | self.items = [NSMutableArray array]; 170 | } 171 | return self; 172 | } 173 | 174 | - (void)layoutSubviews 175 | { 176 | CGFloat height = MIN([self preferredHeight], self.bounds.size.height); 177 | self.containerView.frame = CGRectMake(0, self.bounds.size.height - height, self.bounds.size.width, height); 178 | self.containerView.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.containerView.bounds].CGPath; 179 | if (self.titleLabel) { 180 | self.titleLabel.frame = CGRectMake(HORIZONTAL_PADDING, PADDING_TOP, self.containerView.bounds.size.width - HORIZONTAL_PADDING * 2, [self heightForTitleLabel]); 181 | CGFloat y = PADDING_TOP + self.titleLabel.frame.size.height + GAP; 182 | self.tableView.frame = CGRectMake(0, y, self.containerView.bounds.size.width, self.containerView.bounds.size.height - y); 183 | } else { 184 | self.tableView.frame = self.containerView.bounds; 185 | } 186 | self.backgroundView.frame = self.bounds; 187 | } 188 | 189 | #pragma mark - Public 190 | 191 | - (BOOL)isVisible 192 | { 193 | if (self.actionsheetWindow || self.popoverController) { 194 | return YES; 195 | } 196 | return NO; 197 | } 198 | 199 | - (void)setTitle:(NSString *)title 200 | { 201 | if (_title != title) { 202 | _title = title; 203 | [self setupTitleLabel]; 204 | [self setNeedsLayout]; 205 | } 206 | } 207 | 208 | - (void)addButtonWithTitle:(NSString *)title type:(SIActionSheetButtonType)type handler:(SIActionSheetShowHandler)handler 209 | { 210 | SIActionSheetItem *item = [[SIActionSheetItem alloc] init]; 211 | item.title = title; 212 | item.type = type; 213 | item.action = handler; 214 | [self.items addObject:item]; 215 | } 216 | 217 | - (void)show 218 | { 219 | if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { 220 | NSLog(@"Not support yet, please use showFromRect:inView: instead."); 221 | return; 222 | } 223 | 224 | if (self.isVisible) { 225 | return; 226 | } 227 | 228 | if (self.willShowHandler) { 229 | self.willShowHandler(self); 230 | } 231 | [[NSNotificationCenter defaultCenter] postNotificationName:SIActionSheetWillShowNotification object:self userInfo:nil]; 232 | 233 | SIActionSheetViewController *viewController = [self actionSheetViewController]; 234 | 235 | UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 236 | window.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 237 | window.opaque = NO; 238 | window.windowLevel = UIWindowLevelStatusBar + [UIApplication sharedApplication].windows.count; 239 | window.rootViewController = viewController; 240 | self.actionsheetWindow = window; 241 | 242 | self.oldKeyWindow = [UIApplication sharedApplication].keyWindow; 243 | [self.actionsheetWindow makeKeyAndVisible]; 244 | #ifdef __IPHONE_7_0 245 | if ([self.oldKeyWindow respondsToSelector:@selector(tintAdjustmentMode:)]) { 246 | self.oldTintAdjustmentMode = self.oldKeyWindow.tintAdjustmentMode; 247 | } 248 | #endif 249 | 250 | [self layoutIfNeeded]; 251 | 252 | self.backgroundView.alpha = 0; 253 | CGRect targetRect = self.containerView.frame; 254 | CGRect initialRect = targetRect; 255 | initialRect.origin.y += initialRect.size.height; 256 | self.containerView.frame = initialRect; 257 | [UIView animateWithDuration:0.3 258 | animations:^{ 259 | self.backgroundView.alpha = 1; 260 | self.containerView.frame = targetRect; 261 | #ifdef __IPHONE_7_0 262 | if ([self.oldKeyWindow respondsToSelector:@selector(setTintAdjustmentMode:)]) { 263 | self.oldKeyWindow.tintAdjustmentMode = UIViewTintAdjustmentModeDimmed; 264 | } 265 | #endif 266 | } 267 | completion:^(BOOL finished) { 268 | if (self.didShowHandler) { 269 | self.didShowHandler(self); 270 | } 271 | [[NSNotificationCenter defaultCenter] postNotificationName:SIActionSheetDidShowNotification object:self userInfo:nil]; 272 | }]; 273 | } 274 | 275 | - (void)showFromRect:(CGRect)rect inView:(UIView *)view 276 | { 277 | if (self.isVisible) { 278 | return; 279 | } 280 | 281 | if (self.willShowHandler) { 282 | self.willShowHandler(self); 283 | } 284 | [[NSNotificationCenter defaultCenter] postNotificationName:SIActionSheetWillShowNotification object:self userInfo:nil]; 285 | 286 | [[SIPopoverBackgroundView appearance] setTintColor:self.viewBackgroundColor]; 287 | 288 | SIActionSheetViewController *viewController = [self actionSheetViewController]; 289 | self.popoverController = [[UIPopoverController alloc] initWithContentViewController:viewController]; 290 | self.popoverController.delegate = self; 291 | self.popoverController.popoverBackgroundViewClass = [SIPopoverBackgroundView class]; 292 | 293 | [self.popoverController presentPopoverFromRect:rect inView:view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; 294 | 295 | // tweak ui for popover 296 | self.backgroundView.hidden = YES; 297 | self.containerView.layer.cornerRadius = [[SIPopoverBackgroundView appearance] cornerRadius]; 298 | self.containerView.layer.shadowOpacity = 0; 299 | 300 | if (self.didShowHandler) { 301 | self.didShowHandler(self); 302 | } 303 | [[NSNotificationCenter defaultCenter] postNotificationName:SIActionSheetDidShowNotification object:self userInfo:nil]; 304 | } 305 | 306 | - (void)dismissWithButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated 307 | { 308 | [self dismissWithButtonIndex:buttonIndex animated:animated notifyDelegate:NO]; 309 | } 310 | 311 | - (void)dismissWithButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated notifyDelegate:(BOOL)notifyFlag 312 | { 313 | if (!self.isVisible) { 314 | return; 315 | } 316 | 317 | NSDictionary *userInfo = @{SIActionSheetDismissNotificationUserInfoButtonIndexKey : @(buttonIndex)}; 318 | 319 | if (notifyFlag) { 320 | if (self.willDismissHandler) { 321 | self.willDismissHandler(self, buttonIndex); 322 | } 323 | [[NSNotificationCenter defaultCenter] postNotificationName:SIActionSheetWillDismissNotification object:self userInfo:userInfo]; 324 | } 325 | 326 | if (self.actionsheetWindow) { 327 | void (^dismissCompletion)(void) = ^{ 328 | if (notifyFlag) { 329 | if (self.didDismissHandler) { 330 | self.didDismissHandler(self, buttonIndex); 331 | } 332 | [[NSNotificationCenter defaultCenter] postNotificationName:SIActionSheetDidDismissNotification object:self userInfo:userInfo]; 333 | } 334 | 335 | [self.actionsheetWindow removeFromSuperview]; 336 | self.actionsheetWindow = nil; 337 | 338 | [self.oldKeyWindow makeKeyWindow]; 339 | self.oldKeyWindow = nil; 340 | }; 341 | 342 | if (animated) { 343 | CGRect targetRect = self.containerView.frame; 344 | targetRect.origin.y += targetRect.size.height; 345 | [UIView animateWithDuration:0.3 346 | animations:^{ 347 | self.backgroundView.alpha = 0; 348 | self.containerView.frame = targetRect; 349 | #ifdef __IPHONE_7_0 350 | if ([self.oldKeyWindow respondsToSelector:@selector(setTintAdjustmentMode:)]) { 351 | self.oldKeyWindow.tintAdjustmentMode = self.oldTintAdjustmentMode; 352 | } 353 | #endif 354 | } 355 | completion:^(BOOL finished) { 356 | dismissCompletion(); 357 | }]; 358 | } else { 359 | #ifdef __IPHONE_7_0 360 | if ([self.oldKeyWindow respondsToSelector:@selector(setTintAdjustmentMode:)]) { 361 | self.oldKeyWindow.tintAdjustmentMode = self.oldTintAdjustmentMode; 362 | } 363 | #endif 364 | dismissCompletion(); 365 | } 366 | 367 | } else { 368 | if (self.popoverController) { 369 | [self.popoverController dismissPopoverAnimated:animated]; 370 | self.popoverController = nil; 371 | } 372 | 373 | if (notifyFlag) { 374 | if (self.didDismissHandler) { 375 | self.didDismissHandler(self, buttonIndex); 376 | } 377 | [[NSNotificationCenter defaultCenter] postNotificationName:SIActionSheetDidDismissNotification object:self userInfo:userInfo]; 378 | } 379 | } 380 | } 381 | 382 | #pragma mark - Private 383 | 384 | - (SIActionSheetViewController *)actionSheetViewController 385 | { 386 | SIActionSheetViewController *viewController = [[SIActionSheetViewController alloc] initWithNibName:nil bundle:nil]; 387 | viewController.actionSheet = self; 388 | [self setupViews]; 389 | return viewController; 390 | } 391 | 392 | - (void)setupViews 393 | { 394 | self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 395 | 396 | if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { 397 | self.backgroundView = [[UIView alloc] initWithFrame:self.bounds]; 398 | self.backgroundView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5]; 399 | [self addSubview:self.backgroundView]; 400 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapHandler:)]; 401 | [self.backgroundView addGestureRecognizer:tap]; 402 | } 403 | 404 | self.containerView = [[UIView alloc] initWithFrame:self.bounds]; 405 | self.containerView.layer.shadowOpacity = self.shadowOpacity; 406 | self.containerView.layer.shadowRadius = 3; 407 | self.containerView.layer.shadowOffset = CGSizeZero; 408 | self.containerView.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.containerView.bounds].CGPath; 409 | if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { 410 | self.containerView.backgroundColor = [UIColor clearColor]; 411 | } else { 412 | self.containerView.backgroundColor = self.viewBackgroundColor; 413 | } 414 | [self addSubview:self.containerView]; 415 | 416 | self.tableView = [[UITableView alloc] initWithFrame:self.bounds]; 417 | self.tableView.dataSource = self; 418 | [self.containerView addSubview:self.tableView]; 419 | self.tableView.alwaysBounceVertical = NO; 420 | self.tableView.rowHeight = ROW_HEIGHT; 421 | self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; 422 | self.tableView.contentInset = UIEdgeInsetsMake(VERTICAL_INSET, 0, VERTICAL_INSET, 0); 423 | self.tableView.backgroundColor = [UIColor clearColor]; 424 | 425 | [self setupTitleLabel]; 426 | } 427 | 428 | - (void)setupTitleLabel 429 | { 430 | if (self.title) { 431 | if (!self.titleLabel) { 432 | self.titleLabel = [[UILabel alloc] initWithFrame:self.bounds]; 433 | self.titleLabel.textAlignment = NSTextAlignmentCenter; 434 | self.titleLabel.text = self.title; 435 | self.titleLabel.textColor = self.titleColor; 436 | self.titleLabel.font = self.titleFont; 437 | self.titleLabel.backgroundColor = [UIColor clearColor]; 438 | self.titleLabel.numberOfLines = TITLE_LINES_MAX; 439 | [self.containerView addSubview:self.titleLabel]; 440 | } 441 | self.titleLabel.text = self.title; 442 | } else { 443 | [self.titleLabel removeFromSuperview]; 444 | self.titleLabel = nil; 445 | } 446 | } 447 | 448 | - (CGFloat)preferredHeight 449 | { 450 | CGFloat height = self.items.count * ROW_HEIGHT + VERTICAL_INSET * 2; 451 | if (self.title) { 452 | height += PADDING_TOP + GAP + [self heightForTitleLabel]; 453 | } 454 | return height; 455 | } 456 | 457 | - (CGFloat)heightForTitleLabel 458 | { 459 | CGSize size = [self.title sizeWithFont:self.titleFont constrainedToSize:CGSizeMake(self.bounds.size.width - HORIZONTAL_PADDING * 2, self.titleFont.lineHeight * TITLE_LINES_MAX)]; 460 | return size.height; 461 | } 462 | 463 | #pragma mark - Table view data source 464 | 465 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 466 | { 467 | return self.items.count; 468 | } 469 | 470 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 471 | { 472 | static NSString *CellIdentifier = @"ItemCell"; 473 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 474 | if (!cell) { 475 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; 476 | cell.selectionStyle = UITableViewCellSelectionStyleNone; 477 | } 478 | 479 | while (cell.contentView.subviews.count) { 480 | [cell.contentView.subviews[0] removeFromSuperview]; 481 | } 482 | 483 | SIActionSheetItem *item = self.items[indexPath.row]; 484 | UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; 485 | button.tag = indexPath.row; 486 | button.frame = CGRectMake(HORIZONTAL_PADDING, (ROW_HEIGHT - 44) / 2, cell.contentView.bounds.size.width - HORIZONTAL_PADDING * 2, 44); 487 | button.autoresizingMask = UIViewAutoresizingFlexibleWidth; 488 | button.titleLabel.font = self.buttonFont; 489 | button.titleLabel.adjustsFontSizeToFitWidth = YES; 490 | button.titleLabel.minimumScaleFactor = 0.5; 491 | [button setTitle:item.title forState:UIControlStateNormal]; 492 | UIImage *normalImage = nil; 493 | UIImage *highlightedImage = nil; 494 | switch (item.type) { 495 | case SIActionSheetButtonTypeCancel: 496 | normalImage = [UIImage imageNamed:@"SIActionSheet.bundle/button-cancel"]; 497 | highlightedImage = [UIImage imageNamed:@"SIActionSheet.bundle/button-cancel-d"]; 498 | [button setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal]; 499 | break; 500 | case SIActionSheetButtonTypeDestructive: 501 | normalImage = [UIImage imageNamed:@"SIActionSheet.bundle/button-destructive"]; 502 | highlightedImage = [UIImage imageNamed:@"SIActionSheet.bundle/button-destructive-d"]; 503 | break; 504 | case SIActionSheetButtonTypeDefault: 505 | default: 506 | normalImage = [UIImage imageNamed:@"SIActionSheet.bundle/button-default"]; 507 | highlightedImage = [UIImage imageNamed:@"SIActionSheet.bundle/button-default-d"]; 508 | [button setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal]; 509 | break; 510 | } 511 | CGFloat hInset = floorf(normalImage.size.width / 2); 512 | CGFloat vInset = floorf(normalImage.size.height / 2); 513 | UIEdgeInsets insets = UIEdgeInsetsMake(vInset, hInset, vInset, hInset); 514 | normalImage = [normalImage resizableImageWithCapInsets:insets]; 515 | highlightedImage = [highlightedImage resizableImageWithCapInsets:insets]; 516 | [button setBackgroundImage:normalImage forState:UIControlStateNormal]; 517 | [button setBackgroundImage:highlightedImage forState:UIControlStateHighlighted]; 518 | [button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside]; 519 | 520 | [cell.contentView addSubview:button]; 521 | 522 | return cell; 523 | } 524 | 525 | #pragma mark - UIPopoverControllerDelegate 526 | 527 | - (BOOL)popoverControllerShouldDismissPopover:(UIPopoverController *)popoverController 528 | { 529 | return self.allowTapBackgroundToDismiss; 530 | } 531 | 532 | - (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController 533 | { 534 | [self dismissWithButtonIndex:-1 animated:NO notifyDelegate:YES]; 535 | } 536 | 537 | #pragma mark - Actions 538 | 539 | - (void)buttonAction:(UIButton *)button 540 | { 541 | SIActionSheetItem *item = self.items[button.tag]; 542 | if (item.action) { 543 | item.action(self); 544 | } 545 | [self dismissWithButtonIndex:button.tag animated:YES notifyDelegate:YES]; 546 | } 547 | 548 | - (void)tapHandler:(UIGestureRecognizer *)recognizer 549 | { 550 | if (self.allowTapBackgroundToDismiss) { 551 | [self dismissWithButtonIndex:-1 animated:YES notifyDelegate:YES]; 552 | } 553 | } 554 | 555 | #pragma mark - UIAppearance setters 556 | 557 | - (void)setViewBackgroundColor:(UIColor *)viewBackgroundColor 558 | { 559 | if (_viewBackgroundColor == viewBackgroundColor) { 560 | return; 561 | } 562 | _viewBackgroundColor = viewBackgroundColor; 563 | if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { 564 | [[SIPopoverBackgroundView appearance] setTintColor:viewBackgroundColor]; 565 | } else { 566 | self.containerView.backgroundColor = viewBackgroundColor; 567 | } 568 | } 569 | 570 | - (UIColor *)viewBackgroundColor 571 | { 572 | if (!_viewBackgroundColor) { 573 | return [[[self class] appearance] viewBackgroundColor]; 574 | } 575 | return _viewBackgroundColor; 576 | } 577 | 578 | - (void)setTitleFont:(UIFont *)titleFont 579 | { 580 | if (_titleFont == titleFont) { 581 | return; 582 | } 583 | _titleFont = titleFont; 584 | self.titleLabel.font = titleFont; 585 | } 586 | 587 | - (void)setTitleColor:(UIColor *)titleColor 588 | { 589 | if (_titleColor == titleColor) { 590 | return; 591 | } 592 | _titleColor = titleColor; 593 | self.titleLabel.textColor = titleColor; 594 | } 595 | 596 | - (void)setButtonFont:(UIFont *)buttonFont 597 | { 598 | if (_buttonFont == buttonFont) { 599 | return; 600 | } 601 | _buttonFont = buttonFont; 602 | for (UITableViewCell *cell in self.tableView.visibleCells) { 603 | UIButton *button = cell.contentView.subviews[0]; 604 | button.titleLabel.font = self.buttonFont; 605 | } 606 | } 607 | 608 | - (void)setShadowOpacity:(CGFloat)shadowOpacity 609 | { 610 | if (_shadowOpacity == shadowOpacity) { 611 | return; 612 | } 613 | _shadowOpacity = shadowOpacity; 614 | self.containerView.layer.shadowOpacity = shadowOpacity; 615 | } 616 | 617 | @end 618 | -------------------------------------------------------------------------------- /SIActionSheet/SIPopoverBackgroundView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SIPopoverBackgroundView.h 3 | // SIActionSheet 4 | // 5 | // Created by Kevin Cao on 13-8-7. 6 | // Copyright (c) 2012年 Sumi Interactive. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SIPopoverBackgroundView : UIPopoverBackgroundView 12 | 13 | @property (nonatomic, strong) UIColor *tintColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; // default is white 14 | @property (nonatomic, assign) CGFloat borderWidth NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; // default is 0.0 15 | @property (nonatomic, assign) CGFloat cornerRadius NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; // default is 4.0 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /SIActionSheet/SIPopoverBackgroundView.m: -------------------------------------------------------------------------------- 1 | // 2 | // SIPopoverBackgroundView.m 3 | // SIActionSheet 4 | // 5 | // Created by Kevin Cao on 13-8-7. 6 | // Copyright (c) 2012年 Sumi Interactive. All rights reserved. 7 | // 8 | 9 | #import "SIPopoverBackgroundView.h" 10 | #import 11 | 12 | #define kArrowBase 24.0f 13 | #define kArrowHeight 12.0f 14 | 15 | @interface SIPopoverBackgroundView() 16 | 17 | @property (nonatomic, strong) UIImageView *backgroundImageView; 18 | @property (nonatomic, strong) UIImageView *arrowImageView; 19 | 20 | @property (nonatomic, assign) BOOL needRedrawBackgroundImage; 21 | @property (nonatomic, assign) BOOL needRedrawArrowImage; 22 | 23 | @end 24 | 25 | 26 | @implementation SIPopoverBackgroundView 27 | 28 | @synthesize arrowDirection = _arrowDirection; 29 | @synthesize arrowOffset = _arrowOffset; 30 | 31 | + (void)initialize 32 | { 33 | if (self != [SIPopoverBackgroundView class]) 34 | return; 35 | 36 | SIPopoverBackgroundView *appearance = [self appearance]; 37 | appearance.tintColor = [UIColor whiteColor]; 38 | appearance.borderWidth = 0.0; 39 | appearance.cornerRadius = 4.0; 40 | } 41 | 42 | 43 | #pragma mark - Graphics Methods 44 | 45 | - (UIImage *)fillImage 46 | { 47 | CGSize size = CGSizeMake(self.cornerRadius * 2 + 1, self.cornerRadius * 2 + 1); 48 | UIImage *image = [self drawImageWithWidth:size.width 49 | height:size.height 50 | block:^(CGContextRef context) { 51 | [self.tintColor set]; 52 | CGContextFillEllipseInRect(context, CGRectMake(0, 0, size.width, size.height)); 53 | }]; 54 | image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(self.cornerRadius, self.cornerRadius, self.cornerRadius, self.cornerRadius)]; 55 | return image; 56 | } 57 | 58 | 59 | - (UIImage *)arrowImage 60 | { 61 | CGSize size = CGSizeMake([[self class] arrowBase], [[self class] arrowHeight]); 62 | UIImage *image = [self drawImageWithWidth:size.width 63 | height:size.height 64 | block:^(CGContextRef context) { 65 | CGMutablePathRef arrowPath = CGPathCreateMutable(); 66 | CGPathMoveToPoint(arrowPath, NULL, (size.width/2.0f), 0.0f); //Top Center 67 | CGPathAddLineToPoint(arrowPath, NULL, size.width, size.height); //Bottom Right 68 | CGPathAddLineToPoint(arrowPath, NULL, 0.0f, size.height); //Bottom Right 69 | CGPathCloseSubpath(arrowPath); 70 | CGContextAddPath(context, arrowPath); 71 | CGPathRelease(arrowPath); 72 | [self.tintColor set]; 73 | CGContextDrawPath(context, kCGPathFill); 74 | }]; 75 | return image; 76 | } 77 | 78 | - (UIImage *)drawImageWithWidth:(CGFloat)width height:(CGFloat)height block:(void(^)(CGContextRef context))block 79 | { 80 | CGSize size = CGSizeMake(width, height); 81 | UIGraphicsBeginImageContextWithOptions(size, NO, 0); 82 | CGContextRef context = UIGraphicsGetCurrentContext(); 83 | 84 | if (block) block(context); 85 | 86 | UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); 87 | UIGraphicsEndImageContext(); 88 | return image; 89 | } 90 | 91 | 92 | #pragma mark - UIPopoverBackgroundView Overrides 93 | 94 | - (id)initWithFrame:(CGRect)frame 95 | { 96 | self = [super initWithFrame:frame]; 97 | if (self) { 98 | self.backgroundColor = [UIColor clearColor]; 99 | 100 | self.backgroundImageView = [[UIImageView alloc] init]; 101 | [self addSubview:self.backgroundImageView]; 102 | 103 | self.arrowImageView = [[UIImageView alloc] init]; 104 | [self addSubview:self.arrowImageView]; 105 | 106 | self.needRedrawArrowImage = YES; 107 | self.needRedrawBackgroundImage = YES; 108 | 109 | } 110 | return self; 111 | } 112 | 113 | - (CGFloat)arrowOffset 114 | { 115 | CGFloat arrowOffset = _arrowOffset; 116 | CGFloat arrowHalfBase = [[self class] arrowBase] / 2; 117 | 118 | switch (self.arrowDirection) 119 | { 120 | case UIPopoverArrowDirectionUp: 121 | case UIPopoverArrowDirectionDown: 122 | { 123 | CGFloat width = self.bounds.size.width; 124 | 125 | CGFloat maxOffset = (width/2) - (arrowHalfBase + self.cornerRadius); 126 | if (arrowOffset > maxOffset) return maxOffset; 127 | if (arrowOffset < -maxOffset) return -maxOffset; 128 | 129 | break; 130 | } 131 | 132 | case UIPopoverArrowDirectionLeft: 133 | case UIPopoverArrowDirectionRight: 134 | { 135 | CGFloat height = self.bounds.size.height; 136 | 137 | CGFloat maxOffset = (height/2) - (arrowHalfBase + self.cornerRadius); 138 | if (arrowOffset > maxOffset) return maxOffset; 139 | 140 | CGFloat minOffset = arrowHalfBase - (height/2); 141 | if (arrowOffset < minOffset) return minOffset; 142 | 143 | break; 144 | } 145 | 146 | default: 147 | break; 148 | } 149 | 150 | return arrowOffset; 151 | } 152 | 153 | + (CGFloat)arrowBase 154 | { 155 | return kArrowBase; 156 | } 157 | 158 | + (CGFloat)arrowHeight 159 | { 160 | return kArrowHeight; 161 | } 162 | 163 | + (UIEdgeInsets)contentViewInsets 164 | { 165 | CGFloat inset = [[self appearance] borderWidth]; 166 | return UIEdgeInsetsMake(inset, inset, inset, inset); 167 | } 168 | 169 | + (BOOL)wantsDefaultContentAppearance 170 | { 171 | return NO; 172 | } 173 | 174 | - (void)layoutSubviews 175 | { 176 | if (self.needRedrawBackgroundImage) { 177 | self.backgroundImageView.image = [self fillImage]; 178 | self.needRedrawBackgroundImage = NO; 179 | } 180 | if (self.needRedrawArrowImage) { 181 | self.arrowImageView.image = [self arrowImage]; 182 | self.needRedrawArrowImage = NO; 183 | } 184 | 185 | CGSize arrowSize = CGSizeMake([[self class] arrowBase], [[self class] arrowHeight]); 186 | 187 | CGFloat x = round((self.bounds.size.width - arrowSize.width) / 2); 188 | CGFloat y = round((self.bounds.size.height - arrowSize.width) / 2); 189 | 190 | self.arrowImageView.transform = CGAffineTransformIdentity; 191 | switch (self.arrowDirection) 192 | { 193 | case UIPopoverArrowDirectionUp: 194 | self.backgroundImageView.frame = CGRectMake(0, arrowSize.height, self.bounds.size.width, self.bounds.size.height - arrowSize.height); 195 | self.arrowImageView.frame = CGRectMake(x + self.arrowOffset, 0.0f, arrowSize.width, arrowSize.height); 196 | 197 | break; 198 | 199 | case UIPopoverArrowDirectionLeft: 200 | self.backgroundImageView.frame = CGRectMake(arrowSize.height, 0, self.bounds.size.width - arrowSize.height, self.bounds.size.height); 201 | 202 | self.arrowImageView.transform = CGAffineTransformMakeRotation(-M_PI_2); 203 | self.arrowImageView.frame = CGRectMake(0, y + self.arrowOffset, arrowSize.height, arrowSize.width); 204 | 205 | break; 206 | 207 | case UIPopoverArrowDirectionDown: 208 | self.backgroundImageView.frame = CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height - arrowSize.height); 209 | 210 | self.arrowImageView.transform = CGAffineTransformTranslate(CGAffineTransformMakeScale(1, -1), 0, -arrowSize.height); 211 | self.arrowImageView.frame = CGRectMake(x + self.arrowOffset, self.bounds.size.height - arrowSize.height, arrowSize.width, arrowSize.height); 212 | 213 | break; 214 | 215 | case UIPopoverArrowDirectionRight: 216 | self.backgroundImageView.frame = CGRectMake(0, 0, self.bounds.size.width - arrowSize.height, self.bounds.size.height); 217 | 218 | self.arrowImageView.transform = CGAffineTransformMakeRotation(M_PI_2); 219 | self.arrowImageView.frame = CGRectMake(self.bounds.size.width - arrowSize.height, y + self.arrowOffset, arrowSize.height, arrowSize.width); 220 | 221 | break; 222 | 223 | default: 224 | break; 225 | } 226 | 227 | self.backgroundImageView.layer.shadowPath = [UIBezierPath bezierPathWithRoundedRect:self.backgroundImageView.bounds cornerRadius:self.cornerRadius].CGPath; 228 | self.backgroundImageView.layer.shadowOpacity = 0.3; 229 | self.backgroundImageView.layer.shadowRadius = 20; 230 | self.backgroundImageView.layer.shadowOffset = CGSizeZero; 231 | } 232 | 233 | - (void)setTintColor:(UIColor *)tintColor 234 | { 235 | if (_tintColor == tintColor) { 236 | return; 237 | } 238 | _tintColor = tintColor; 239 | 240 | self.needRedrawArrowImage = YES; 241 | self.needRedrawBackgroundImage = YES; 242 | [self setNeedsLayout]; 243 | } 244 | 245 | - (void)setBorderWidth:(CGFloat)borderWidth 246 | { 247 | if (_borderWidth == borderWidth) { 248 | return; 249 | } 250 | _borderWidth = borderWidth; 251 | [self setNeedsLayout]; 252 | } 253 | 254 | - (void)setCornerRadius:(CGFloat)cornerRadius 255 | { 256 | if (_cornerRadius == cornerRadius) { 257 | return; 258 | } 259 | _cornerRadius = cornerRadius; 260 | 261 | self.needRedrawBackgroundImage = YES; 262 | [self setNeedsLayout]; 263 | } 264 | 265 | @end 266 | -------------------------------------------------------------------------------- /SIActionSheet/UIWindow+SIUtils.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIWindow+SIUtils.h 3 | // SIActionSheet 4 | // 5 | // Created by Kevin Cao on 13-11-1. 6 | // Copyright (c) 2013年 Sumi Interactive. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIWindow (SIUtils) 12 | 13 | - (UIViewController *)currentViewController; 14 | 15 | #ifdef __IPHONE_7_0 16 | - (UIViewController *)viewControllerForStatusBarStyle; 17 | - (UIViewController *)viewControllerForStatusBarHidden; 18 | #endif 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /SIActionSheet/UIWindow+SIUtils.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIWindow+SIUtils.m 3 | // SIActionSheet 4 | // 5 | // Created by Kevin Cao on 13-11-1. 6 | // Copyright (c) 2013年 Sumi Interactive. All rights reserved. 7 | // 8 | 9 | #import "UIWindow+SIUtils.h" 10 | 11 | @implementation UIWindow (SIUtils) 12 | 13 | - (UIViewController *)currentViewController 14 | { 15 | UIViewController *viewController = self.rootViewController; 16 | while (viewController.presentedViewController) { 17 | viewController = viewController.presentedViewController; 18 | } 19 | return viewController; 20 | } 21 | 22 | #ifdef __IPHONE_7_0 23 | 24 | - (UIViewController *)viewControllerForStatusBarStyle 25 | { 26 | UIViewController *currentViewController = [self currentViewController]; 27 | 28 | while ([currentViewController childViewControllerForStatusBarStyle]) { 29 | currentViewController = [currentViewController childViewControllerForStatusBarStyle]; 30 | } 31 | return currentViewController; 32 | } 33 | 34 | - (UIViewController *)viewControllerForStatusBarHidden 35 | { 36 | UIViewController *currentViewController = [self currentViewController]; 37 | 38 | while ([currentViewController childViewControllerForStatusBarHidden]) { 39 | currentViewController = [currentViewController childViewControllerForStatusBarHidden]; 40 | } 41 | return currentViewController; 42 | } 43 | 44 | #endif 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /SIActionSheetExample/Icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sumi-Interactive/SIActionSheet/f7b4c6f8e75c098988f7c8e654362293dfbfb89b/SIActionSheetExample/Icon-72.png -------------------------------------------------------------------------------- /SIActionSheetExample/Icon-72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sumi-Interactive/SIActionSheet/f7b4c6f8e75c098988f7c8e654362293dfbfb89b/SIActionSheetExample/Icon-72@2x.png -------------------------------------------------------------------------------- /SIActionSheetExample/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sumi-Interactive/SIActionSheet/f7b4c6f8e75c098988f7c8e654362293dfbfb89b/SIActionSheetExample/Icon.png -------------------------------------------------------------------------------- /SIActionSheetExample/Icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sumi-Interactive/SIActionSheet/f7b4c6f8e75c098988f7c8e654362293dfbfb89b/SIActionSheetExample/Icon@2x.png -------------------------------------------------------------------------------- /SIActionSheetExample/SIActionSheetExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 7E5C34D317B3E4EB009145D4 /* SIPopoverBackgroundView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E5C34D217B3E4EB009145D4 /* SIPopoverBackgroundView.m */; }; 11 | 7EC33FAE1752051000CF4BAA /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7EC33FAD1752051000CF4BAA /* UIKit.framework */; }; 12 | 7EC33FB01752051000CF4BAA /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7EC33FAF1752051000CF4BAA /* Foundation.framework */; }; 13 | 7EC33FB21752051000CF4BAA /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7EC33FB11752051000CF4BAA /* CoreGraphics.framework */; }; 14 | 7EC33FB81752051000CF4BAA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 7EC33FB61752051000CF4BAA /* InfoPlist.strings */; }; 15 | 7EC33FBA1752051000CF4BAA /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 7EC33FB91752051000CF4BAA /* main.m */; }; 16 | 7EC33FBE1752051000CF4BAA /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7EC33FBD1752051000CF4BAA /* AppDelegate.m */; }; 17 | 7EC33FC01752051000CF4BAA /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 7EC33FBF1752051000CF4BAA /* Default.png */; }; 18 | 7EC33FC21752051000CF4BAA /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7EC33FC11752051000CF4BAA /* Default@2x.png */; }; 19 | 7EC33FC41752051000CF4BAA /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7EC33FC31752051000CF4BAA /* Default-568h@2x.png */; }; 20 | 7EC33FC71752051000CF4BAA /* MainStoryboard_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7EC33FC51752051000CF4BAA /* MainStoryboard_iPhone.storyboard */; }; 21 | 7EC33FCA1752051100CF4BAA /* MainStoryboard_iPad.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7EC33FC81752051000CF4BAA /* MainStoryboard_iPad.storyboard */; }; 22 | 7EC33FCD1752051100CF4BAA /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7EC33FCC1752051100CF4BAA /* ViewController.m */; }; 23 | 7EC33FD71752055700CF4BAA /* SIActionSheet.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 7EC33FD41752055700CF4BAA /* SIActionSheet.bundle */; }; 24 | 7EC33FD81752055700CF4BAA /* SIActionSheet.m in Sources */ = {isa = PBXBuildFile; fileRef = 7EC33FD61752055700CF4BAA /* SIActionSheet.m */; }; 25 | 7EC33FDA1752057A00CF4BAA /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 7EC33FD91752057A00CF4BAA /* Icon.png */; }; 26 | 7EC33FDC1752057E00CF4BAA /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7EC33FDB1752057E00CF4BAA /* Icon@2x.png */; }; 27 | 7EC33FDE1752058500CF4BAA /* Icon-72.png in Resources */ = {isa = PBXBuildFile; fileRef = 7EC33FDD1752058500CF4BAA /* Icon-72.png */; }; 28 | 7EC33FE01752058800CF4BAA /* Icon-72@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7EC33FDF1752058800CF4BAA /* Icon-72@2x.png */; }; 29 | 7EC33FE517534D0000CF4BAA /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7EC33FE417534D0000CF4BAA /* QuartzCore.framework */; }; 30 | 7EEECA6C1823521A001FEDF5 /* UIWindow+SIUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 7EEECA6B1823521A001FEDF5 /* UIWindow+SIUtils.m */; }; 31 | /* End PBXBuildFile section */ 32 | 33 | /* Begin PBXFileReference section */ 34 | 7E5C34D117B3E4EB009145D4 /* SIPopoverBackgroundView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SIPopoverBackgroundView.h; sourceTree = ""; }; 35 | 7E5C34D217B3E4EB009145D4 /* SIPopoverBackgroundView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SIPopoverBackgroundView.m; sourceTree = ""; }; 36 | 7EC33FAA1752051000CF4BAA /* SIActionSheetExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SIActionSheetExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 37 | 7EC33FAD1752051000CF4BAA /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 38 | 7EC33FAF1752051000CF4BAA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 39 | 7EC33FB11752051000CF4BAA /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 40 | 7EC33FB51752051000CF4BAA /* SIActionSheetExample-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SIActionSheetExample-Info.plist"; sourceTree = ""; }; 41 | 7EC33FB71752051000CF4BAA /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 42 | 7EC33FB91752051000CF4BAA /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 43 | 7EC33FBB1752051000CF4BAA /* SIActionSheetExample-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SIActionSheetExample-Prefix.pch"; sourceTree = ""; }; 44 | 7EC33FBC1752051000CF4BAA /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 45 | 7EC33FBD1752051000CF4BAA /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 46 | 7EC33FBF1752051000CF4BAA /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; 47 | 7EC33FC11752051000CF4BAA /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; }; 48 | 7EC33FC31752051000CF4BAA /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; 49 | 7EC33FC61752051000CF4BAA /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/MainStoryboard_iPhone.storyboard; sourceTree = ""; }; 50 | 7EC33FC91752051100CF4BAA /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/MainStoryboard_iPad.storyboard; sourceTree = ""; }; 51 | 7EC33FCB1752051100CF4BAA /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 52 | 7EC33FCC1752051100CF4BAA /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 53 | 7EC33FD41752055700CF4BAA /* SIActionSheet.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = SIActionSheet.bundle; sourceTree = ""; }; 54 | 7EC33FD51752055700CF4BAA /* SIActionSheet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SIActionSheet.h; sourceTree = ""; }; 55 | 7EC33FD61752055700CF4BAA /* SIActionSheet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SIActionSheet.m; sourceTree = ""; }; 56 | 7EC33FD91752057A00CF4BAA /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = ""; }; 57 | 7EC33FDB1752057E00CF4BAA /* Icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon@2x.png"; sourceTree = ""; }; 58 | 7EC33FDD1752058500CF4BAA /* Icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-72.png"; sourceTree = ""; }; 59 | 7EC33FDF1752058800CF4BAA /* Icon-72@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-72@2x.png"; sourceTree = ""; }; 60 | 7EC33FE417534D0000CF4BAA /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 61 | 7EEECA6A1823521A001FEDF5 /* UIWindow+SIUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIWindow+SIUtils.h"; sourceTree = ""; }; 62 | 7EEECA6B1823521A001FEDF5 /* UIWindow+SIUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIWindow+SIUtils.m"; sourceTree = ""; }; 63 | /* End PBXFileReference section */ 64 | 65 | /* Begin PBXFrameworksBuildPhase section */ 66 | 7EC33FA71752051000CF4BAA /* Frameworks */ = { 67 | isa = PBXFrameworksBuildPhase; 68 | buildActionMask = 2147483647; 69 | files = ( 70 | 7EC33FE517534D0000CF4BAA /* QuartzCore.framework in Frameworks */, 71 | 7EC33FAE1752051000CF4BAA /* UIKit.framework in Frameworks */, 72 | 7EC33FB01752051000CF4BAA /* Foundation.framework in Frameworks */, 73 | 7EC33FB21752051000CF4BAA /* CoreGraphics.framework in Frameworks */, 74 | ); 75 | runOnlyForDeploymentPostprocessing = 0; 76 | }; 77 | /* End PBXFrameworksBuildPhase section */ 78 | 79 | /* Begin PBXGroup section */ 80 | 7EC33FA11752051000CF4BAA = { 81 | isa = PBXGroup; 82 | children = ( 83 | 7EC33FD31752055700CF4BAA /* SIActionSheet */, 84 | 7EC33FB31752051000CF4BAA /* SIActionSheetExample */, 85 | 7EC33FAC1752051000CF4BAA /* Frameworks */, 86 | 7EC33FAB1752051000CF4BAA /* Products */, 87 | ); 88 | sourceTree = ""; 89 | }; 90 | 7EC33FAB1752051000CF4BAA /* Products */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | 7EC33FAA1752051000CF4BAA /* SIActionSheetExample.app */, 94 | ); 95 | name = Products; 96 | sourceTree = ""; 97 | }; 98 | 7EC33FAC1752051000CF4BAA /* Frameworks */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 7EC33FE417534D0000CF4BAA /* QuartzCore.framework */, 102 | 7EC33FAD1752051000CF4BAA /* UIKit.framework */, 103 | 7EC33FAF1752051000CF4BAA /* Foundation.framework */, 104 | 7EC33FB11752051000CF4BAA /* CoreGraphics.framework */, 105 | ); 106 | name = Frameworks; 107 | sourceTree = ""; 108 | }; 109 | 7EC33FB31752051000CF4BAA /* SIActionSheetExample */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | 7EC33FE1175205D100CF4BAA /* Icons */, 113 | 7EC33FE2175205E000CF4BAA /* UI */, 114 | 7EC33FE3175205E700CF4BAA /* Classes */, 115 | 7EC33FB41752051000CF4BAA /* Supporting Files */, 116 | ); 117 | path = SIActionSheetExample; 118 | sourceTree = ""; 119 | }; 120 | 7EC33FB41752051000CF4BAA /* Supporting Files */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | 7EC33FB51752051000CF4BAA /* SIActionSheetExample-Info.plist */, 124 | 7EC33FB61752051000CF4BAA /* InfoPlist.strings */, 125 | 7EC33FB91752051000CF4BAA /* main.m */, 126 | 7EC33FBB1752051000CF4BAA /* SIActionSheetExample-Prefix.pch */, 127 | 7EC33FBF1752051000CF4BAA /* Default.png */, 128 | 7EC33FC11752051000CF4BAA /* Default@2x.png */, 129 | 7EC33FC31752051000CF4BAA /* Default-568h@2x.png */, 130 | ); 131 | name = "Supporting Files"; 132 | sourceTree = ""; 133 | }; 134 | 7EC33FD31752055700CF4BAA /* SIActionSheet */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | 7EC33FD41752055700CF4BAA /* SIActionSheet.bundle */, 138 | 7EC33FD51752055700CF4BAA /* SIActionSheet.h */, 139 | 7EC33FD61752055700CF4BAA /* SIActionSheet.m */, 140 | 7EEECA6A1823521A001FEDF5 /* UIWindow+SIUtils.h */, 141 | 7EEECA6B1823521A001FEDF5 /* UIWindow+SIUtils.m */, 142 | 7E5C34D117B3E4EB009145D4 /* SIPopoverBackgroundView.h */, 143 | 7E5C34D217B3E4EB009145D4 /* SIPopoverBackgroundView.m */, 144 | ); 145 | name = SIActionSheet; 146 | path = ../SIActionSheet; 147 | sourceTree = ""; 148 | }; 149 | 7EC33FE1175205D100CF4BAA /* Icons */ = { 150 | isa = PBXGroup; 151 | children = ( 152 | 7EC33FDF1752058800CF4BAA /* Icon-72@2x.png */, 153 | 7EC33FDD1752058500CF4BAA /* Icon-72.png */, 154 | 7EC33FDB1752057E00CF4BAA /* Icon@2x.png */, 155 | 7EC33FD91752057A00CF4BAA /* Icon.png */, 156 | ); 157 | name = Icons; 158 | path = ..; 159 | sourceTree = ""; 160 | }; 161 | 7EC33FE2175205E000CF4BAA /* UI */ = { 162 | isa = PBXGroup; 163 | children = ( 164 | 7EC33FC51752051000CF4BAA /* MainStoryboard_iPhone.storyboard */, 165 | 7EC33FC81752051000CF4BAA /* MainStoryboard_iPad.storyboard */, 166 | ); 167 | name = UI; 168 | sourceTree = ""; 169 | }; 170 | 7EC33FE3175205E700CF4BAA /* Classes */ = { 171 | isa = PBXGroup; 172 | children = ( 173 | 7EC33FBC1752051000CF4BAA /* AppDelegate.h */, 174 | 7EC33FBD1752051000CF4BAA /* AppDelegate.m */, 175 | 7EC33FCB1752051100CF4BAA /* ViewController.h */, 176 | 7EC33FCC1752051100CF4BAA /* ViewController.m */, 177 | ); 178 | name = Classes; 179 | sourceTree = ""; 180 | }; 181 | /* End PBXGroup section */ 182 | 183 | /* Begin PBXNativeTarget section */ 184 | 7EC33FA91752051000CF4BAA /* SIActionSheetExample */ = { 185 | isa = PBXNativeTarget; 186 | buildConfigurationList = 7EC33FD01752051100CF4BAA /* Build configuration list for PBXNativeTarget "SIActionSheetExample" */; 187 | buildPhases = ( 188 | 7EC33FA61752051000CF4BAA /* Sources */, 189 | 7EC33FA71752051000CF4BAA /* Frameworks */, 190 | 7EC33FA81752051000CF4BAA /* Resources */, 191 | ); 192 | buildRules = ( 193 | ); 194 | dependencies = ( 195 | ); 196 | name = SIActionSheetExample; 197 | productName = SIActionSheetExample; 198 | productReference = 7EC33FAA1752051000CF4BAA /* SIActionSheetExample.app */; 199 | productType = "com.apple.product-type.application"; 200 | }; 201 | /* End PBXNativeTarget section */ 202 | 203 | /* Begin PBXProject section */ 204 | 7EC33FA21752051000CF4BAA /* Project object */ = { 205 | isa = PBXProject; 206 | attributes = { 207 | LastUpgradeCheck = 0460; 208 | ORGANIZATIONNAME = "Sumi Interactive"; 209 | }; 210 | buildConfigurationList = 7EC33FA51752051000CF4BAA /* Build configuration list for PBXProject "SIActionSheetExample" */; 211 | compatibilityVersion = "Xcode 3.2"; 212 | developmentRegion = English; 213 | hasScannedForEncodings = 0; 214 | knownRegions = ( 215 | en, 216 | ); 217 | mainGroup = 7EC33FA11752051000CF4BAA; 218 | productRefGroup = 7EC33FAB1752051000CF4BAA /* Products */; 219 | projectDirPath = ""; 220 | projectRoot = ""; 221 | targets = ( 222 | 7EC33FA91752051000CF4BAA /* SIActionSheetExample */, 223 | ); 224 | }; 225 | /* End PBXProject section */ 226 | 227 | /* Begin PBXResourcesBuildPhase section */ 228 | 7EC33FA81752051000CF4BAA /* Resources */ = { 229 | isa = PBXResourcesBuildPhase; 230 | buildActionMask = 2147483647; 231 | files = ( 232 | 7EC33FB81752051000CF4BAA /* InfoPlist.strings in Resources */, 233 | 7EC33FC01752051000CF4BAA /* Default.png in Resources */, 234 | 7EC33FC21752051000CF4BAA /* Default@2x.png in Resources */, 235 | 7EC33FC41752051000CF4BAA /* Default-568h@2x.png in Resources */, 236 | 7EC33FC71752051000CF4BAA /* MainStoryboard_iPhone.storyboard in Resources */, 237 | 7EC33FCA1752051100CF4BAA /* MainStoryboard_iPad.storyboard in Resources */, 238 | 7EC33FD71752055700CF4BAA /* SIActionSheet.bundle in Resources */, 239 | 7EC33FDA1752057A00CF4BAA /* Icon.png in Resources */, 240 | 7EC33FDC1752057E00CF4BAA /* Icon@2x.png in Resources */, 241 | 7EC33FDE1752058500CF4BAA /* Icon-72.png in Resources */, 242 | 7EC33FE01752058800CF4BAA /* Icon-72@2x.png in Resources */, 243 | ); 244 | runOnlyForDeploymentPostprocessing = 0; 245 | }; 246 | /* End PBXResourcesBuildPhase section */ 247 | 248 | /* Begin PBXSourcesBuildPhase section */ 249 | 7EC33FA61752051000CF4BAA /* Sources */ = { 250 | isa = PBXSourcesBuildPhase; 251 | buildActionMask = 2147483647; 252 | files = ( 253 | 7EC33FBA1752051000CF4BAA /* main.m in Sources */, 254 | 7EC33FBE1752051000CF4BAA /* AppDelegate.m in Sources */, 255 | 7EC33FCD1752051100CF4BAA /* ViewController.m in Sources */, 256 | 7EC33FD81752055700CF4BAA /* SIActionSheet.m in Sources */, 257 | 7E5C34D317B3E4EB009145D4 /* SIPopoverBackgroundView.m in Sources */, 258 | 7EEECA6C1823521A001FEDF5 /* UIWindow+SIUtils.m in Sources */, 259 | ); 260 | runOnlyForDeploymentPostprocessing = 0; 261 | }; 262 | /* End PBXSourcesBuildPhase section */ 263 | 264 | /* Begin PBXVariantGroup section */ 265 | 7EC33FB61752051000CF4BAA /* InfoPlist.strings */ = { 266 | isa = PBXVariantGroup; 267 | children = ( 268 | 7EC33FB71752051000CF4BAA /* en */, 269 | ); 270 | name = InfoPlist.strings; 271 | sourceTree = ""; 272 | }; 273 | 7EC33FC51752051000CF4BAA /* MainStoryboard_iPhone.storyboard */ = { 274 | isa = PBXVariantGroup; 275 | children = ( 276 | 7EC33FC61752051000CF4BAA /* en */, 277 | ); 278 | name = MainStoryboard_iPhone.storyboard; 279 | sourceTree = ""; 280 | }; 281 | 7EC33FC81752051000CF4BAA /* MainStoryboard_iPad.storyboard */ = { 282 | isa = PBXVariantGroup; 283 | children = ( 284 | 7EC33FC91752051100CF4BAA /* en */, 285 | ); 286 | name = MainStoryboard_iPad.storyboard; 287 | sourceTree = ""; 288 | }; 289 | /* End PBXVariantGroup section */ 290 | 291 | /* Begin XCBuildConfiguration section */ 292 | 7EC33FCE1752051100CF4BAA /* Debug */ = { 293 | isa = XCBuildConfiguration; 294 | buildSettings = { 295 | ALWAYS_SEARCH_USER_PATHS = NO; 296 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 297 | CLANG_CXX_LIBRARY = "libc++"; 298 | CLANG_ENABLE_OBJC_ARC = YES; 299 | CLANG_WARN_CONSTANT_CONVERSION = YES; 300 | CLANG_WARN_EMPTY_BODY = YES; 301 | CLANG_WARN_ENUM_CONVERSION = YES; 302 | CLANG_WARN_INT_CONVERSION = YES; 303 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 304 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 305 | COPY_PHASE_STRIP = NO; 306 | GCC_C_LANGUAGE_STANDARD = gnu99; 307 | GCC_DYNAMIC_NO_PIC = NO; 308 | GCC_OPTIMIZATION_LEVEL = 0; 309 | GCC_PREPROCESSOR_DEFINITIONS = ( 310 | "DEBUG=1", 311 | "$(inherited)", 312 | ); 313 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 314 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 315 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 316 | GCC_WARN_UNUSED_VARIABLE = YES; 317 | IPHONEOS_DEPLOYMENT_TARGET = 6.1; 318 | ONLY_ACTIVE_ARCH = YES; 319 | SDKROOT = iphoneos; 320 | TARGETED_DEVICE_FAMILY = "1,2"; 321 | }; 322 | name = Debug; 323 | }; 324 | 7EC33FCF1752051100CF4BAA /* Release */ = { 325 | isa = XCBuildConfiguration; 326 | buildSettings = { 327 | ALWAYS_SEARCH_USER_PATHS = NO; 328 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 329 | CLANG_CXX_LIBRARY = "libc++"; 330 | CLANG_ENABLE_OBJC_ARC = YES; 331 | CLANG_WARN_CONSTANT_CONVERSION = YES; 332 | CLANG_WARN_EMPTY_BODY = YES; 333 | CLANG_WARN_ENUM_CONVERSION = YES; 334 | CLANG_WARN_INT_CONVERSION = YES; 335 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 336 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 337 | COPY_PHASE_STRIP = YES; 338 | GCC_C_LANGUAGE_STANDARD = gnu99; 339 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 340 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 341 | GCC_WARN_UNUSED_VARIABLE = YES; 342 | IPHONEOS_DEPLOYMENT_TARGET = 6.1; 343 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 344 | SDKROOT = iphoneos; 345 | TARGETED_DEVICE_FAMILY = "1,2"; 346 | VALIDATE_PRODUCT = YES; 347 | }; 348 | name = Release; 349 | }; 350 | 7EC33FD11752051100CF4BAA /* Debug */ = { 351 | isa = XCBuildConfiguration; 352 | buildSettings = { 353 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 354 | GCC_PREFIX_HEADER = "SIActionSheetExample/SIActionSheetExample-Prefix.pch"; 355 | INFOPLIST_FILE = "SIActionSheetExample/SIActionSheetExample-Info.plist"; 356 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 357 | PRODUCT_NAME = "$(TARGET_NAME)"; 358 | WRAPPER_EXTENSION = app; 359 | }; 360 | name = Debug; 361 | }; 362 | 7EC33FD21752051100CF4BAA /* Release */ = { 363 | isa = XCBuildConfiguration; 364 | buildSettings = { 365 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 366 | GCC_PREFIX_HEADER = "SIActionSheetExample/SIActionSheetExample-Prefix.pch"; 367 | INFOPLIST_FILE = "SIActionSheetExample/SIActionSheetExample-Info.plist"; 368 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 369 | PRODUCT_NAME = "$(TARGET_NAME)"; 370 | WRAPPER_EXTENSION = app; 371 | }; 372 | name = Release; 373 | }; 374 | /* End XCBuildConfiguration section */ 375 | 376 | /* Begin XCConfigurationList section */ 377 | 7EC33FA51752051000CF4BAA /* Build configuration list for PBXProject "SIActionSheetExample" */ = { 378 | isa = XCConfigurationList; 379 | buildConfigurations = ( 380 | 7EC33FCE1752051100CF4BAA /* Debug */, 381 | 7EC33FCF1752051100CF4BAA /* Release */, 382 | ); 383 | defaultConfigurationIsVisible = 0; 384 | defaultConfigurationName = Release; 385 | }; 386 | 7EC33FD01752051100CF4BAA /* Build configuration list for PBXNativeTarget "SIActionSheetExample" */ = { 387 | isa = XCConfigurationList; 388 | buildConfigurations = ( 389 | 7EC33FD11752051100CF4BAA /* Debug */, 390 | 7EC33FD21752051100CF4BAA /* Release */, 391 | ); 392 | defaultConfigurationIsVisible = 0; 393 | defaultConfigurationName = Release; 394 | }; 395 | /* End XCConfigurationList section */ 396 | }; 397 | rootObject = 7EC33FA21752051000CF4BAA /* Project object */; 398 | } 399 | -------------------------------------------------------------------------------- /SIActionSheetExample/SIActionSheetExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // SIActionSheetExample 4 | // 5 | // Created by Kevin Cao on 13-5-26. 6 | // Copyright (c) 2013年 Sumi Interactive. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /SIActionSheetExample/SIActionSheetExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // SIActionSheetExample 4 | // 5 | // Created by Kevin Cao on 13-5-26. 6 | // Copyright (c) 2013年 Sumi Interactive. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | return YES; 17 | } 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application 20 | { 21 | // 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. 22 | // 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. 23 | } 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application 26 | { 27 | // 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. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | - (void)applicationWillEnterForeground:(UIApplication *)application 32 | { 33 | // 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. 34 | } 35 | 36 | - (void)applicationDidBecomeActive:(UIApplication *)application 37 | { 38 | // 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. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application 42 | { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /SIActionSheetExample/SIActionSheetExample/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sumi-Interactive/SIActionSheet/f7b4c6f8e75c098988f7c8e654362293dfbfb89b/SIActionSheetExample/SIActionSheetExample/Default-568h@2x.png -------------------------------------------------------------------------------- /SIActionSheetExample/SIActionSheetExample/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sumi-Interactive/SIActionSheet/f7b4c6f8e75c098988f7c8e654362293dfbfb89b/SIActionSheetExample/SIActionSheetExample/Default.png -------------------------------------------------------------------------------- /SIActionSheetExample/SIActionSheetExample/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sumi-Interactive/SIActionSheet/f7b4c6f8e75c098988f7c8e654362293dfbfb89b/SIActionSheetExample/SIActionSheetExample/Default@2x.png -------------------------------------------------------------------------------- /SIActionSheetExample/SIActionSheetExample/SIActionSheetExample-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIcons 12 | 13 | CFBundlePrimaryIcon 14 | 15 | CFBundleIconFiles 16 | 17 | Icon.png 18 | Icon@2x.png 19 | Icon-72.png 20 | Icon-72@2x.png 21 | 22 | UIPrerenderedIcon 23 | 24 | 25 | 26 | CFBundleIdentifier 27 | com.sumi-sumi.${PRODUCT_NAME:rfc1034identifier} 28 | CFBundleInfoDictionaryVersion 29 | 6.0 30 | CFBundleName 31 | ${PRODUCT_NAME} 32 | CFBundlePackageType 33 | APPL 34 | CFBundleShortVersionString 35 | 1.0 36 | CFBundleSignature 37 | ???? 38 | CFBundleVersion 39 | 1.0 40 | LSRequiresIPhoneOS 41 | 42 | UIMainStoryboardFile 43 | MainStoryboard_iPhone 44 | UIMainStoryboardFile~ipad 45 | MainStoryboard_iPad 46 | UIPrerenderedIcon 47 | 48 | UIRequiredDeviceCapabilities 49 | 50 | armv7 51 | 52 | UISupportedInterfaceOrientations 53 | 54 | UIInterfaceOrientationPortrait 55 | UIInterfaceOrientationLandscapeLeft 56 | UIInterfaceOrientationLandscapeRight 57 | 58 | UISupportedInterfaceOrientations~ipad 59 | 60 | UIInterfaceOrientationPortrait 61 | UIInterfaceOrientationPortraitUpsideDown 62 | UIInterfaceOrientationLandscapeLeft 63 | UIInterfaceOrientationLandscapeRight 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /SIActionSheetExample/SIActionSheetExample/SIActionSheetExample-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'SIActionSheetExample' target in the 'SIActionSheetExample' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_5_0 8 | #warning "This project uses features only available in iOS SDK 5.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /SIActionSheetExample/SIActionSheetExample/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // SIActionSheetExample 4 | // 5 | // Created by Kevin Cao on 13-5-26. 6 | // Copyright (c) 2013年 Sumi Interactive. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /SIActionSheetExample/SIActionSheetExample/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // SIActionSheetExample 4 | // 5 | // Created by Kevin Cao on 13-5-26. 6 | // Copyright (c) 2013年 Sumi Interactive. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "SIActionSheet.h" 11 | 12 | #define TEST_APPEARANCE 0 13 | 14 | @interface ViewController () 15 | 16 | @end 17 | 18 | @implementation ViewController 19 | 20 | - (void)viewDidLoad 21 | { 22 | [super viewDidLoad]; 23 | #if TEST_APPEARANCE 24 | [[SIActionSheet appearance] setTitleFont:[UIFont boldSystemFontOfSize:18]]; 25 | [[SIActionSheet appearance] setTitleColor:[UIColor redColor]]; 26 | [[SIActionSheet appearance] setButtonFont:[UIFont fontWithName:@"AmericanTypewriter" size:17]]; 27 | [[SIActionSheet appearance] setShadowOpacity:1]; 28 | [[SIActionSheet appearance] setViewBackgroundColor:[UIColor lightGrayColor]]; 29 | #endif 30 | } 31 | 32 | - (void)didReceiveMemoryWarning 33 | { 34 | [super didReceiveMemoryWarning]; 35 | // Dispose of any resources that can be recreated. 36 | } 37 | 38 | - (IBAction)show1:(id)sender 39 | { 40 | SIActionSheet *actionSheet = [[SIActionSheet alloc] initWithTitle:@"Sumi"]; 41 | [actionSheet addButtonWithTitle:@"Button1" type:SIActionSheetButtonTypeDefault handler:^(SIActionSheet *actionSheet) { 42 | NSLog(@"%@", actionSheet); 43 | [self show2:nil]; 44 | }]; 45 | [actionSheet addButtonWithTitle:@"Button2" type:SIActionSheetButtonTypeDestructive handler:^(SIActionSheet *actionSheet) { 46 | NSLog(@"%@", actionSheet); 47 | }]; 48 | [actionSheet addButtonWithTitle:@"Cancel" type:SIActionSheetButtonTypeCancel handler:^(SIActionSheet *actionSheet) { 49 | NSLog(@"%@", actionSheet); 50 | }]; 51 | actionSheet.willShowHandler = ^(SIActionSheet *actionSheet) { 52 | NSLog(@"willShowHandler"); 53 | }; 54 | actionSheet.didShowHandler = ^(SIActionSheet *actionSheet) { 55 | NSLog(@"didShowHandler"); 56 | }; 57 | actionSheet.willDismissHandler = ^(SIActionSheet *actionSheet, NSInteger buttonIndex) { 58 | NSLog(@"willDismissHandler:%d", buttonIndex); 59 | }; 60 | actionSheet.didDismissHandler = ^(SIActionSheet *actionSheet, NSInteger buttonIndex) { 61 | NSLog(@"didDismissHandler:%d", buttonIndex); 62 | }; 63 | actionSheet.allowTapBackgroundToDismiss = YES; 64 | [actionSheet show]; 65 | 66 | double delayInSeconds = 1.0; 67 | dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); 68 | dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ 69 | actionSheet.title = @"NOTE: iCloud preference will overwrite local preference. The passcode will not be synced. "; 70 | actionSheet.titleFont = [UIFont systemFontOfSize:14]; 71 | }); 72 | } 73 | 74 | - (IBAction)show2:(id)sender 75 | { 76 | SIActionSheet *actionSheet = [[SIActionSheet alloc] initWithTitle:@"NOTE: iCloud preference will overwrite local preference. The passcode will not be synced. NOTE: iCloud preference will overwrite local preference. The passcode will not be synced. NOTE: iCloud preference will overwrite local preference. The passcode will not be synced."]; 77 | [actionSheet addButtonWithTitle:@"A Very Very Very Very Very Long Title Button1" type:SIActionSheetButtonTypeDefault handler:^(SIActionSheet *actionSheet) { 78 | NSLog(@"%@", actionSheet); 79 | }]; 80 | [actionSheet addButtonWithTitle:@"Button2" type:SIActionSheetButtonTypeCancel handler:^(SIActionSheet *actionSheet) { 81 | NSLog(@"%@", actionSheet); 82 | }]; 83 | [actionSheet show]; 84 | actionSheet.titleColor = [UIColor redColor]; 85 | actionSheet.buttonFont = [UIFont fontWithName:@"AmericanTypewriter" size:17]; 86 | } 87 | 88 | - (IBAction)show3:(id)sender 89 | { 90 | SIActionSheet *actionSheet = [[SIActionSheet alloc] initWithTitle:@"NOTE: iCloud preference will overwrite local preference. The passcode will not be synced. "]; 91 | [actionSheet addButtonWithTitle:@"Button1" type:SIActionSheetButtonTypeDefault handler:^(SIActionSheet *actionSheet) { 92 | NSLog(@"Button1"); 93 | }]; 94 | [actionSheet addButtonWithTitle:@"Button2" type:SIActionSheetButtonTypeDestructive handler:^(SIActionSheet *actionSheet) { 95 | NSLog(@"Button2"); 96 | }]; 97 | actionSheet.willShowHandler = ^(SIActionSheet *actionSheet) { 98 | NSLog(@"willShowHandler"); 99 | }; 100 | actionSheet.didShowHandler = ^(SIActionSheet *actionSheet) { 101 | NSLog(@"didShowHandler"); 102 | }; 103 | actionSheet.willDismissHandler = ^(SIActionSheet *actionSheet, NSInteger buttonIndex) { 104 | NSLog(@"willDismissHandler:%d", buttonIndex); 105 | }; 106 | actionSheet.didDismissHandler = ^(SIActionSheet *actionSheet, NSInteger buttonIndex) { 107 | NSLog(@"didDismissHandler:%d", buttonIndex); 108 | }; 109 | actionSheet.allowTapBackgroundToDismiss = YES; 110 | [actionSheet showFromRect:[sender frame] inView:self.view]; 111 | } 112 | 113 | - (IBAction)show4:(id)sender 114 | { 115 | 116 | UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Hello" 117 | delegate:self 118 | cancelButtonTitle:nil 119 | destructiveButtonTitle:nil 120 | otherButtonTitles:@"OK", nil]; 121 | 122 | [actionSheet showFromRect:[sender frame] inView:self.view animated:YES]; 123 | } 124 | 125 | - (void)actionSheet:(UIActionSheet *)actionSheet willDismissWithButtonIndex:(NSInteger)buttonIndex 126 | { 127 | NSLog(@"buttonIndex%d", buttonIndex); 128 | } 129 | 130 | - (void)actionSheetCancel:(UIActionSheet *)actionSheet 131 | { 132 | NSLog(@"cancel"); 133 | } 134 | 135 | - (UIStatusBarStyle)preferredStatusBarStyle 136 | { 137 | return UIStatusBarStyleLightContent; 138 | } 139 | 140 | @end 141 | -------------------------------------------------------------------------------- /SIActionSheetExample/SIActionSheetExample/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /SIActionSheetExample/SIActionSheetExample/en.lproj/MainStoryboard_iPad.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 26 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /SIActionSheetExample/SIActionSheetExample/en.lproj/MainStoryboard_iPhone.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 26 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /SIActionSheetExample/SIActionSheetExample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SIActionSheetExample 4 | // 5 | // Created by Kevin Cao on 13-5-26. 6 | // Copyright (c) 2013年 Sumi Interactive. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | --------------------------------------------------------------------------------