├── .gitignore ├── KSToastView.podspec ├── KSToastView ├── KSToastView.h └── KSToastView.m ├── KSToastViewDemo.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── KSToastViewDemo ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── ViewController.h ├── ViewController.m └── main.m ├── KSToastViewDemoTests ├── Info.plist └── KSToastViewDemoTests.m ├── LICENSE ├── README.md └── ScreenShot └── ScreenShot.gif /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io 2 | 3 | ### Xcode ### 4 | build/ 5 | *.pbxuser 6 | !default.pbxuser 7 | *.mode1v3 8 | !default.mode1v3 9 | *.mode2v3 10 | !default.mode2v3 11 | *.perspectivev3 12 | !default.perspectivev3 13 | xcuserdata 14 | *.xccheckout 15 | *.moved-aside 16 | DerivedData 17 | *.xcuserstate 18 | 19 | 20 | #!! ERROR: ios is undefined. Use list command to see defined gitignore types !!# 21 | 22 | ### OSX ### 23 | .DS_Store 24 | .AppleDouble 25 | .LSOverride 26 | 27 | # Icon must end with two \r 28 | Icon 29 | 30 | # Thumbnails 31 | ._* 32 | 33 | # Files that might appear in the root of a volume 34 | .DocumentRevisions-V100 35 | .fseventsd 36 | .Spotlight-V100 37 | .TemporaryItems 38 | .Trashes 39 | .VolumeIcon.icns 40 | 41 | # Directories potentially created on remote AFP share 42 | .AppleDB 43 | .AppleDesktop 44 | Network Trash Folder 45 | Temporary Items 46 | .apdisk 47 | 48 | 49 | ### Objective-C ### 50 | # Xcode 51 | # 52 | build/ 53 | *.pbxuser 54 | !default.pbxuser 55 | *.mode1v3 56 | !default.mode1v3 57 | *.mode2v3 58 | !default.mode2v3 59 | *.perspectivev3 60 | !default.perspectivev3 61 | xcuserdata 62 | *.xccheckout 63 | *.moved-aside 64 | DerivedData 65 | *.hmap 66 | *.ipa 67 | *.xcuserstate 68 | 69 | # CocoaPods 70 | # 71 | # We recommend against adding the Pods directory to your .gitignore. However 72 | # you should judge for yourself, the pros and cons are mentioned at: 73 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 74 | # 75 | #Pods/ 76 | 77 | -------------------------------------------------------------------------------- /KSToastView.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |spec| 2 | spec.name = 'KSToastView' 3 | spec.version = '0.5.7' 4 | spec.summary = 'Simple Popup Notification inspired by Android Toast Widget.' 5 | spec.description = 'Simple Popup Notification inspired by Android Toast Widget (http://developer.android.com/intl/zh-cn/guide/topics/ui/notifiers/toasts.html).' 6 | spec.homepage = 'https://github.com/c0ming/KSToastView' 7 | spec.license = { :type => 'MIT', :file => 'LICENSE' } 8 | spec.author = { 'c0ming' => 'https://github.com/c0ming' } 9 | spec.platform = :ios, '7.0' 10 | spec.source = { :git => 'https://github.com/c0ming/KSToastView.git', :tag => 'v0.5.7' } 11 | spec.source_files = 'KSToastView/*.{h,m}' 12 | spec.framework = 'QuartzCore' 13 | spec.requires_arc = true 14 | end 15 | -------------------------------------------------------------------------------- /KSToastView/KSToastView.h: -------------------------------------------------------------------------------- 1 | // 2 | // KSToastView.h 3 | // 4 | // The MIT License (MIT) 5 | // 6 | // Copyright (c) 2015 c0ming ( https://github.com/c0ming ) 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in all 16 | // copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | // SOFTWARE. 25 | 26 | #import 27 | 28 | typedef void (^KSToastBlock)(void); 29 | 30 | @interface KSToastView : UIView 31 | 32 | /** 33 | * ToastView Config 34 | */ 35 | + (void)ks_setAppearanceBackgroundColor:(UIColor *)backgroundColor; 36 | + (void)ks_setAppearanceCornerRadius:(CGFloat)cornerRadius; 37 | + (void)ks_setAppearanceMaxWidth:(CGFloat)maxWidth; 38 | + (void)ks_setAppearanceMaxLines:(NSInteger)maxLines; 39 | + (void)ks_setAppearanceOffsetBottom:(CGFloat)offsetBottom; 40 | + (void)ks_setAppearanceTextAligment:(NSTextAlignment)textAlignment; 41 | + (void)ks_setAppearanceTextColor:(UIColor *)textColor; 42 | + (void)ks_setAppearanceTextFont:(UIFont *)textFont; 43 | + (void)ks_setAppearanceTextInsets:(UIEdgeInsets)textInsets; 44 | + (void)ks_setToastViewShowDuration:(NSTimeInterval)duration; 45 | 46 | /** 47 | * ToastView Show 48 | */ 49 | + (void)ks_showToast:(id)toast; 50 | + (void)ks_showToast:(id)toast duration:(NSTimeInterval)duration; 51 | + (void)ks_showToast:(id)toast delay:(NSTimeInterval)delay; 52 | + (void)ks_showToast:(id)toast completion:(KSToastBlock)completion; 53 | + (void)ks_showToast:(id)toast duration:(NSTimeInterval)duration delay:(NSTimeInterval)delay; 54 | + (void)ks_showToast:(id)toast duration:(NSTimeInterval)duration completion:(KSToastBlock)completion; 55 | + (void)ks_showToast:(id)toast delay:(NSTimeInterval)delay completion:(KSToastBlock)completion; 56 | + (void)ks_showToast:(id)toast duration:(NSTimeInterval)duration delay:(NSTimeInterval)delay completion:(KSToastBlock)completion; 57 | 58 | /** 59 | * @Deprecated 60 | * Please use + (void)ks_setAppearanceTextInsets:(UIEdgeInsets)textInsets; 61 | */ 62 | + (void)ks_setAppearanceTextPadding:(CGFloat)textPadding __attribute__((deprecated)); 63 | 64 | /** 65 | * @Deprecated 66 | * Please use + (void)ks_setAppearanceMaxLines:(CGFloat)maxLines; 67 | */ 68 | + (void)ks_setAppearanceMaxHeight:(CGFloat)maxHeight __attribute__((deprecated)); 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /KSToastView/KSToastView.m: -------------------------------------------------------------------------------- 1 | // 2 | // KSToastView.m 3 | // 4 | // The MIT License (MIT) 5 | // 6 | // Copyright (c) 2015 c0ming ( https://github.com/c0ming ) 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in all 16 | // copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | // SOFTWARE. 25 | 26 | #import "KSToastView.h" 27 | 28 | #define KS_TOAST_VIEW_ANIMATION_DURATION 0.5f 29 | #define KS_TOAST_VIEW_OFFSET_BOTTOM 61.0f 30 | #define KS_TOAST_VIEW_OFFSET_LEFT_RIGHT 8.0f 31 | #define KS_TOAST_VIEW_OFFSET_TOP 76.0f 32 | #define KS_TOAST_VIEW_SHOW_DURATION 3.0f 33 | #define KS_TOAST_VIEW_SHOW_DELAY 0.0f 34 | #define KS_TOAST_VIEW_TAG 1024 35 | #define KS_TOAST_VIEW_TEXT_FONT_SIZE 17.0f 36 | 37 | static UIColor *_backgroundColor = nil; 38 | static UIColor *_textColor = nil; 39 | static UIFont *_textFont = nil; 40 | static CGFloat _cornerRadius = 0.0f; 41 | static CGFloat _duration = KS_TOAST_VIEW_SHOW_DURATION; 42 | static CGFloat _maxWidth = 0.0f; 43 | static CGFloat _maxHeight = 0.0f; 44 | static NSInteger _maxLines = 0; 45 | static CGFloat _offsetBottom = KS_TOAST_VIEW_OFFSET_BOTTOM; 46 | static CGFloat _offsetTop = KS_TOAST_VIEW_OFFSET_TOP; 47 | static UIEdgeInsets _textInsets; 48 | static NSTextAlignment _textAligment = NSTextAlignmentCenter; 49 | 50 | @interface KSToastView () 51 | 52 | @end 53 | 54 | @implementation KSToastView 55 | 56 | #pragma mark - ToastView Config 57 | 58 | + (void)ks_setAppearanceBackgroundColor:(UIColor *)backgroundColor { 59 | _backgroundColor = [backgroundColor copy]; 60 | } 61 | 62 | + (void)ks_setAppearanceCornerRadius:(CGFloat)cornerRadius { 63 | _cornerRadius = cornerRadius; 64 | } 65 | 66 | + (void)ks_setAppearanceMaxWidth:(CGFloat)maxWidth { 67 | _maxWidth = maxWidth; 68 | } 69 | 70 | + (void)ks_setAppearanceMaxLines:(NSInteger)maxLines { 71 | _maxLines = maxLines; 72 | } 73 | 74 | + (void)ks_setAppearanceOffsetBottom:(CGFloat)offsetBottom { 75 | _offsetBottom = offsetBottom; 76 | } 77 | 78 | + (void)ks_setAppearanceTextAligment:(NSTextAlignment)textAlignment { 79 | _textAligment = textAlignment; 80 | } 81 | 82 | + (void)ks_setAppearanceTextColor:(UIColor *)textColor { 83 | _textColor = [textColor copy]; 84 | } 85 | 86 | + (void)ks_setAppearanceTextFont:(UIFont *)textFont { 87 | _textFont = [textFont copy]; 88 | } 89 | 90 | + (void)ks_setAppearanceTextInsets:(UIEdgeInsets)textInsets { 91 | _textInsets = textInsets; 92 | } 93 | 94 | + (void)ks_setToastViewShowDuration:(NSTimeInterval)duration { 95 | _duration = duration; 96 | } 97 | 98 | #pragma mark - ToastView Show 99 | 100 | + (void)ks_showToast:(id)toast { 101 | return [self ks_showToast:toast duration:_duration]; 102 | } 103 | 104 | + (void)ks_showToast:(id)toast duration:(NSTimeInterval)duration { 105 | return [self ks_showToast:toast duration:duration delay:KS_TOAST_VIEW_SHOW_DELAY]; 106 | } 107 | 108 | + (void)ks_showToast:(id)toast delay:(NSTimeInterval)delay { 109 | return [self ks_showToast:toast duration:_duration delay:delay]; 110 | } 111 | 112 | + (void)ks_showToast:(id)toast completion:(KSToastBlock)completion { 113 | return [self ks_showToast:toast duration:_duration completion:completion]; 114 | } 115 | 116 | + (void)ks_showToast:(id)toast duration:(NSTimeInterval)duration delay:(NSTimeInterval)delay { 117 | return [self ks_showToast:toast duration:duration delay:delay completion:nil]; 118 | } 119 | 120 | + (void)ks_showToast:(id)toast duration:(NSTimeInterval)duration completion:(KSToastBlock)completion { 121 | return [self ks_showToast:toast duration:duration delay:KS_TOAST_VIEW_SHOW_DELAY completion:completion]; 122 | } 123 | 124 | + (void)ks_showToast:(id)toast delay:(NSTimeInterval)delay completion:(KSToastBlock)completion { 125 | return [self ks_showToast:toast duration:_duration delay:delay completion:completion]; 126 | } 127 | 128 | + (void)ks_showToast:(id)toast duration:(NSTimeInterval)duration delay:(NSTimeInterval)delay completion:(KSToastBlock)completion { 129 | NSString *toastText = [NSString stringWithFormat:@"%@", toast]; 130 | if (toastText.length < 1) { 131 | return; 132 | } 133 | 134 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delay * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 135 | UIView *keyWindow = [self _keyWindow]; 136 | if (!keyWindow) { 137 | return; 138 | } 139 | [[keyWindow viewWithTag:KS_TOAST_VIEW_TAG] removeFromSuperview]; 140 | [keyWindow endEditing:YES]; 141 | 142 | UIView *toastView = [UIView new]; 143 | toastView.translatesAutoresizingMaskIntoConstraints = NO; 144 | toastView.userInteractionEnabled = NO; 145 | toastView.backgroundColor = [self _backgroundColor]; 146 | toastView.tag = KS_TOAST_VIEW_TAG; 147 | toastView.clipsToBounds = YES; 148 | toastView.alpha = 0.0f; 149 | 150 | UILabel *toastLabel = [UILabel new]; 151 | toastLabel.translatesAutoresizingMaskIntoConstraints = NO; 152 | toastLabel.font = [self _textFont]; 153 | toastLabel.text = toastText; 154 | toastLabel.textColor = [self _textColor]; 155 | toastLabel.textAlignment = _textAligment; 156 | toastLabel.numberOfLines = 0; 157 | 158 | [self _maxWidth]; 159 | [self _maxHeight]; 160 | 161 | // One line text's height 162 | CGFloat toastTextHeight = [@"KS" sizeWithAttributes:@{ NSFontAttributeName:[self _textFont], }].height + 0.5f; 163 | 164 | // ToastView's textInsets 165 | if (UIEdgeInsetsEqualToEdgeInsets(_textInsets, UIEdgeInsetsZero)) { 166 | _textInsets = UIEdgeInsetsMake(toastTextHeight / 2.0f, toastTextHeight, toastTextHeight / 2.0f, toastTextHeight); 167 | } 168 | 169 | if (_cornerRadius <= 0.0f || _cornerRadius > toastTextHeight / 2.0f) { 170 | toastView.layer.cornerRadius = (toastTextHeight + _textInsets.top + _textInsets.bottom) / 2.0f; 171 | } else { 172 | toastView.layer.cornerRadius = _cornerRadius; 173 | } 174 | 175 | // ToastView's size 176 | CGSize toastLabelSize = [toastLabel sizeThatFits:CGSizeMake(_maxWidth - (_textInsets.left + _textInsets.right), _maxHeight - (_textInsets.top + _textInsets.bottom))]; 177 | CGFloat toastViewWidth = (toastLabelSize.width + 0.5f) + (_textInsets.left + _textInsets.right); 178 | CGFloat toastViewHeight = (toastLabelSize.height + 0.5f) + (_textInsets.top + _textInsets.bottom); 179 | 180 | if (toastViewWidth > _maxWidth) { 181 | toastViewWidth = _maxWidth; 182 | } 183 | 184 | if (_maxLines > 0) { 185 | toastViewHeight = toastTextHeight * _maxLines + _textInsets.top + _textInsets.bottom; 186 | } 187 | 188 | if (toastViewHeight > _maxHeight) { 189 | toastViewHeight = _maxHeight; 190 | } 191 | 192 | NSDictionary *views = NSDictionaryOfVariableBindings(toastLabel, toastView); 193 | [toastView addSubview:toastLabel]; 194 | [keyWindow addSubview:toastView]; 195 | 196 | [toastView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:[NSString stringWithFormat:@"H:|-(%@)-[toastLabel]-(%@)-|", @(_textInsets.left), @(_textInsets.right)] 197 | options:0 198 | metrics:nil 199 | views:views]]; 200 | [toastView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:[NSString stringWithFormat:@"V:|-(%@)-[toastLabel]-(%@)-|", @(_textInsets.top), @(_textInsets.bottom)] 201 | options:0 202 | metrics:nil 203 | views:views]]; 204 | 205 | [keyWindow addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:[NSString stringWithFormat:@"H:[toastView(%@)]", @(toastViewWidth)] 206 | options:0 207 | metrics:nil 208 | views:views]]; 209 | [keyWindow addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:[NSString stringWithFormat:@"V:|-(>=%@)-[toastView(<=%@)]-(%@)-|", @(_offsetTop), @(toastViewHeight), @(_offsetBottom)] 210 | options:0 211 | metrics:nil 212 | views:views]]; 213 | [keyWindow addConstraint:[NSLayoutConstraint constraintWithItem:toastView 214 | attribute:NSLayoutAttributeCenterX 215 | relatedBy:NSLayoutRelationEqual 216 | toItem:keyWindow 217 | attribute:NSLayoutAttributeCenterX 218 | multiplier:1.0f 219 | constant:0.0f]]; 220 | [keyWindow layoutIfNeeded]; 221 | 222 | [UIView animateWithDuration:KS_TOAST_VIEW_ANIMATION_DURATION animations: ^{ 223 | toastView.alpha = 1.0f; 224 | }]; 225 | 226 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 227 | [UIView animateWithDuration:KS_TOAST_VIEW_ANIMATION_DURATION animations: ^{ 228 | toastView.alpha = 0.0f; 229 | } completion: ^(BOOL finished) { 230 | [toastView removeFromSuperview]; 231 | 232 | KSToastBlock block = [completion copy]; 233 | if (block) { 234 | block(); 235 | } 236 | }]; 237 | }); 238 | }); 239 | } 240 | 241 | #pragma mark - Deprecated 242 | 243 | + (void)ks_setAppearanceTextPadding:(CGFloat)textPadding { 244 | // nothing 245 | } 246 | 247 | + (void)ks_setAppearanceMaxHeight:(CGFloat)maxHeight { 248 | // _maxHeight = maxHeight; 249 | } 250 | 251 | #pragma mark - Private Methods 252 | 253 | + (UIFont *)_textFont { 254 | if (_textFont == nil) { 255 | _textFont = [UIFont systemFontOfSize:KS_TOAST_VIEW_TEXT_FONT_SIZE]; 256 | } 257 | return _textFont; 258 | } 259 | 260 | + (UIColor *)_textColor { 261 | if (_textColor == nil) { 262 | _textColor = [UIColor whiteColor]; 263 | } 264 | return _textColor; 265 | } 266 | 267 | + (UIColor *)_backgroundColor { 268 | if (_backgroundColor == nil) { 269 | _backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.6f]; 270 | } 271 | return _backgroundColor; 272 | } 273 | 274 | + (CGFloat)_maxHeight { 275 | if (_maxHeight <= 0) { 276 | _maxHeight = [self _portraitScreenHeight] - (_offsetBottom + KS_TOAST_VIEW_OFFSET_TOP); 277 | } 278 | 279 | return _maxHeight; 280 | } 281 | 282 | + (CGFloat)_maxWidth { 283 | if (_maxWidth <= 0) { 284 | _maxWidth = [self _portraitScreenWidth] - (KS_TOAST_VIEW_OFFSET_LEFT_RIGHT + KS_TOAST_VIEW_OFFSET_LEFT_RIGHT); 285 | } 286 | return _maxWidth; 287 | } 288 | 289 | + (CGFloat)_portraitScreenWidth { 290 | return UIInterfaceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation) ? CGRectGetWidth([UIScreen mainScreen].bounds) : CGRectGetHeight([UIScreen mainScreen].bounds); 291 | } 292 | 293 | + (CGFloat)_portraitScreenHeight { 294 | return UIInterfaceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation) ? CGRectGetHeight([UIScreen mainScreen].bounds) : CGRectGetWidth([UIScreen mainScreen].bounds); 295 | } 296 | 297 | + (UIView *)_keyWindow { 298 | return [UIApplication sharedApplication].delegate.window; 299 | } 300 | 301 | @end 302 | -------------------------------------------------------------------------------- /KSToastViewDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | A9FE215F1B254A0B0058D2C1 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = A9FE215E1B254A0B0058D2C1 /* main.m */; }; 11 | A9FE21621B254A0B0058D2C1 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A9FE21611B254A0B0058D2C1 /* AppDelegate.m */; }; 12 | A9FE21681B254A0B0058D2C1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A9FE21661B254A0B0058D2C1 /* Main.storyboard */; }; 13 | A9FE216A1B254A0B0058D2C1 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A9FE21691B254A0B0058D2C1 /* Images.xcassets */; }; 14 | A9FE216D1B254A0B0058D2C1 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9FE216B1B254A0B0058D2C1 /* LaunchScreen.xib */; }; 15 | A9FE21791B254A0B0058D2C1 /* KSToastViewDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = A9FE21781B254A0B0058D2C1 /* KSToastViewDemoTests.m */; }; 16 | A9FE218A1B255DCF0058D2C1 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9FE21891B255DCF0058D2C1 /* ViewController.m */; }; 17 | A9FE21951B25620E0058D2C1 /* KSToastView.m in Sources */ = {isa = PBXBuildFile; fileRef = A9FE21941B25620E0058D2C1 /* KSToastView.m */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | A9FE21731B254A0B0058D2C1 /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = A9FE21511B254A0B0058D2C1 /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = A9FE21581B254A0B0058D2C1; 26 | remoteInfo = KSToastViewDemo; 27 | }; 28 | /* End PBXContainerItemProxy section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | A9FE21591B254A0B0058D2C1 /* KSToastViewDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = KSToastViewDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 32 | A9FE215D1B254A0B0058D2C1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 33 | A9FE215E1B254A0B0058D2C1 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 34 | A9FE21601B254A0B0058D2C1 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 35 | A9FE21611B254A0B0058D2C1 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 36 | A9FE21671B254A0B0058D2C1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 37 | A9FE21691B254A0B0058D2C1 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 38 | A9FE216C1B254A0B0058D2C1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 39 | A9FE21721B254A0B0058D2C1 /* KSToastViewDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KSToastViewDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | A9FE21771B254A0B0058D2C1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 41 | A9FE21781B254A0B0058D2C1 /* KSToastViewDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KSToastViewDemoTests.m; sourceTree = ""; }; 42 | A9FE21881B255DCF0058D2C1 /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 43 | A9FE21891B255DCF0058D2C1 /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 44 | A9FE21931B25620E0058D2C1 /* KSToastView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KSToastView.h; path = KSToastView/KSToastView.h; sourceTree = SOURCE_ROOT; }; 45 | A9FE21941B25620E0058D2C1 /* KSToastView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = KSToastView.m; path = KSToastView/KSToastView.m; sourceTree = SOURCE_ROOT; }; 46 | /* End PBXFileReference section */ 47 | 48 | /* Begin PBXFrameworksBuildPhase section */ 49 | A9FE21561B254A0B0058D2C1 /* Frameworks */ = { 50 | isa = PBXFrameworksBuildPhase; 51 | buildActionMask = 2147483647; 52 | files = ( 53 | ); 54 | runOnlyForDeploymentPostprocessing = 0; 55 | }; 56 | A9FE216F1B254A0B0058D2C1 /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | ); 61 | runOnlyForDeploymentPostprocessing = 0; 62 | }; 63 | /* End PBXFrameworksBuildPhase section */ 64 | 65 | /* Begin PBXGroup section */ 66 | A9FE21501B254A0B0058D2C1 = { 67 | isa = PBXGroup; 68 | children = ( 69 | A9FE215B1B254A0B0058D2C1 /* KSToastViewDemo */, 70 | A9FE21751B254A0B0058D2C1 /* KSToastViewDemoTests */, 71 | A9FE215A1B254A0B0058D2C1 /* Products */, 72 | ); 73 | sourceTree = ""; 74 | }; 75 | A9FE215A1B254A0B0058D2C1 /* Products */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | A9FE21591B254A0B0058D2C1 /* KSToastViewDemo.app */, 79 | A9FE21721B254A0B0058D2C1 /* KSToastViewDemoTests.xctest */, 80 | ); 81 | name = Products; 82 | sourceTree = ""; 83 | }; 84 | A9FE215B1B254A0B0058D2C1 /* KSToastViewDemo */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | A9FE21961B2562120058D2C1 /* KSToastView */, 88 | A9FE21601B254A0B0058D2C1 /* AppDelegate.h */, 89 | A9FE21611B254A0B0058D2C1 /* AppDelegate.m */, 90 | A9FE21881B255DCF0058D2C1 /* ViewController.h */, 91 | A9FE21891B255DCF0058D2C1 /* ViewController.m */, 92 | A9FE21661B254A0B0058D2C1 /* Main.storyboard */, 93 | A9FE21691B254A0B0058D2C1 /* Images.xcassets */, 94 | A9FE216B1B254A0B0058D2C1 /* LaunchScreen.xib */, 95 | A9FE215C1B254A0B0058D2C1 /* Supporting Files */, 96 | ); 97 | path = KSToastViewDemo; 98 | sourceTree = ""; 99 | }; 100 | A9FE215C1B254A0B0058D2C1 /* Supporting Files */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | A9FE215D1B254A0B0058D2C1 /* Info.plist */, 104 | A9FE215E1B254A0B0058D2C1 /* main.m */, 105 | ); 106 | name = "Supporting Files"; 107 | sourceTree = ""; 108 | }; 109 | A9FE21751B254A0B0058D2C1 /* KSToastViewDemoTests */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | A9FE21781B254A0B0058D2C1 /* KSToastViewDemoTests.m */, 113 | A9FE21761B254A0B0058D2C1 /* Supporting Files */, 114 | ); 115 | path = KSToastViewDemoTests; 116 | sourceTree = ""; 117 | }; 118 | A9FE21761B254A0B0058D2C1 /* Supporting Files */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | A9FE21771B254A0B0058D2C1 /* Info.plist */, 122 | ); 123 | name = "Supporting Files"; 124 | sourceTree = ""; 125 | }; 126 | A9FE21961B2562120058D2C1 /* KSToastView */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | A9FE21931B25620E0058D2C1 /* KSToastView.h */, 130 | A9FE21941B25620E0058D2C1 /* KSToastView.m */, 131 | ); 132 | name = KSToastView; 133 | sourceTree = ""; 134 | }; 135 | /* End PBXGroup section */ 136 | 137 | /* Begin PBXNativeTarget section */ 138 | A9FE21581B254A0B0058D2C1 /* KSToastViewDemo */ = { 139 | isa = PBXNativeTarget; 140 | buildConfigurationList = A9FE217C1B254A0B0058D2C1 /* Build configuration list for PBXNativeTarget "KSToastViewDemo" */; 141 | buildPhases = ( 142 | A9FE21551B254A0B0058D2C1 /* Sources */, 143 | A9FE21561B254A0B0058D2C1 /* Frameworks */, 144 | A9FE21571B254A0B0058D2C1 /* Resources */, 145 | ); 146 | buildRules = ( 147 | ); 148 | dependencies = ( 149 | ); 150 | name = KSToastViewDemo; 151 | productName = KSToastViewDemo; 152 | productReference = A9FE21591B254A0B0058D2C1 /* KSToastViewDemo.app */; 153 | productType = "com.apple.product-type.application"; 154 | }; 155 | A9FE21711B254A0B0058D2C1 /* KSToastViewDemoTests */ = { 156 | isa = PBXNativeTarget; 157 | buildConfigurationList = A9FE217F1B254A0B0058D2C1 /* Build configuration list for PBXNativeTarget "KSToastViewDemoTests" */; 158 | buildPhases = ( 159 | A9FE216E1B254A0B0058D2C1 /* Sources */, 160 | A9FE216F1B254A0B0058D2C1 /* Frameworks */, 161 | A9FE21701B254A0B0058D2C1 /* Resources */, 162 | ); 163 | buildRules = ( 164 | ); 165 | dependencies = ( 166 | A9FE21741B254A0B0058D2C1 /* PBXTargetDependency */, 167 | ); 168 | name = KSToastViewDemoTests; 169 | productName = KSToastViewDemoTests; 170 | productReference = A9FE21721B254A0B0058D2C1 /* KSToastViewDemoTests.xctest */; 171 | productType = "com.apple.product-type.bundle.unit-test"; 172 | }; 173 | /* End PBXNativeTarget section */ 174 | 175 | /* Begin PBXProject section */ 176 | A9FE21511B254A0B0058D2C1 /* Project object */ = { 177 | isa = PBXProject; 178 | attributes = { 179 | LastUpgradeCheck = 0700; 180 | ORGANIZATIONNAME = c0ming; 181 | TargetAttributes = { 182 | A9FE21581B254A0B0058D2C1 = { 183 | CreatedOnToolsVersion = 6.3; 184 | }; 185 | A9FE21711B254A0B0058D2C1 = { 186 | CreatedOnToolsVersion = 6.3; 187 | TestTargetID = A9FE21581B254A0B0058D2C1; 188 | }; 189 | }; 190 | }; 191 | buildConfigurationList = A9FE21541B254A0B0058D2C1 /* Build configuration list for PBXProject "KSToastViewDemo" */; 192 | compatibilityVersion = "Xcode 3.2"; 193 | developmentRegion = English; 194 | hasScannedForEncodings = 0; 195 | knownRegions = ( 196 | en, 197 | Base, 198 | ); 199 | mainGroup = A9FE21501B254A0B0058D2C1; 200 | productRefGroup = A9FE215A1B254A0B0058D2C1 /* Products */; 201 | projectDirPath = ""; 202 | projectRoot = ""; 203 | targets = ( 204 | A9FE21581B254A0B0058D2C1 /* KSToastViewDemo */, 205 | A9FE21711B254A0B0058D2C1 /* KSToastViewDemoTests */, 206 | ); 207 | }; 208 | /* End PBXProject section */ 209 | 210 | /* Begin PBXResourcesBuildPhase section */ 211 | A9FE21571B254A0B0058D2C1 /* Resources */ = { 212 | isa = PBXResourcesBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | A9FE21681B254A0B0058D2C1 /* Main.storyboard in Resources */, 216 | A9FE216D1B254A0B0058D2C1 /* LaunchScreen.xib in Resources */, 217 | A9FE216A1B254A0B0058D2C1 /* Images.xcassets in Resources */, 218 | ); 219 | runOnlyForDeploymentPostprocessing = 0; 220 | }; 221 | A9FE21701B254A0B0058D2C1 /* Resources */ = { 222 | isa = PBXResourcesBuildPhase; 223 | buildActionMask = 2147483647; 224 | files = ( 225 | ); 226 | runOnlyForDeploymentPostprocessing = 0; 227 | }; 228 | /* End PBXResourcesBuildPhase section */ 229 | 230 | /* Begin PBXSourcesBuildPhase section */ 231 | A9FE21551B254A0B0058D2C1 /* Sources */ = { 232 | isa = PBXSourcesBuildPhase; 233 | buildActionMask = 2147483647; 234 | files = ( 235 | A9FE21951B25620E0058D2C1 /* KSToastView.m in Sources */, 236 | A9FE21621B254A0B0058D2C1 /* AppDelegate.m in Sources */, 237 | A9FE218A1B255DCF0058D2C1 /* ViewController.m in Sources */, 238 | A9FE215F1B254A0B0058D2C1 /* main.m in Sources */, 239 | ); 240 | runOnlyForDeploymentPostprocessing = 0; 241 | }; 242 | A9FE216E1B254A0B0058D2C1 /* Sources */ = { 243 | isa = PBXSourcesBuildPhase; 244 | buildActionMask = 2147483647; 245 | files = ( 246 | A9FE21791B254A0B0058D2C1 /* KSToastViewDemoTests.m in Sources */, 247 | ); 248 | runOnlyForDeploymentPostprocessing = 0; 249 | }; 250 | /* End PBXSourcesBuildPhase section */ 251 | 252 | /* Begin PBXTargetDependency section */ 253 | A9FE21741B254A0B0058D2C1 /* PBXTargetDependency */ = { 254 | isa = PBXTargetDependency; 255 | target = A9FE21581B254A0B0058D2C1 /* KSToastViewDemo */; 256 | targetProxy = A9FE21731B254A0B0058D2C1 /* PBXContainerItemProxy */; 257 | }; 258 | /* End PBXTargetDependency section */ 259 | 260 | /* Begin PBXVariantGroup section */ 261 | A9FE21661B254A0B0058D2C1 /* Main.storyboard */ = { 262 | isa = PBXVariantGroup; 263 | children = ( 264 | A9FE21671B254A0B0058D2C1 /* Base */, 265 | ); 266 | name = Main.storyboard; 267 | sourceTree = ""; 268 | }; 269 | A9FE216B1B254A0B0058D2C1 /* LaunchScreen.xib */ = { 270 | isa = PBXVariantGroup; 271 | children = ( 272 | A9FE216C1B254A0B0058D2C1 /* Base */, 273 | ); 274 | name = LaunchScreen.xib; 275 | sourceTree = ""; 276 | }; 277 | /* End PBXVariantGroup section */ 278 | 279 | /* Begin XCBuildConfiguration section */ 280 | A9FE217A1B254A0B0058D2C1 /* Debug */ = { 281 | isa = XCBuildConfiguration; 282 | buildSettings = { 283 | ALWAYS_SEARCH_USER_PATHS = NO; 284 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 285 | CLANG_CXX_LIBRARY = "libc++"; 286 | CLANG_ENABLE_MODULES = YES; 287 | CLANG_ENABLE_OBJC_ARC = YES; 288 | CLANG_WARN_BOOL_CONVERSION = YES; 289 | CLANG_WARN_CONSTANT_CONVERSION = YES; 290 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 291 | CLANG_WARN_EMPTY_BODY = YES; 292 | CLANG_WARN_ENUM_CONVERSION = YES; 293 | CLANG_WARN_INT_CONVERSION = YES; 294 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 295 | CLANG_WARN_UNREACHABLE_CODE = YES; 296 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 297 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 298 | COPY_PHASE_STRIP = NO; 299 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 300 | ENABLE_STRICT_OBJC_MSGSEND = YES; 301 | ENABLE_TESTABILITY = YES; 302 | GCC_C_LANGUAGE_STANDARD = gnu99; 303 | GCC_DYNAMIC_NO_PIC = NO; 304 | GCC_NO_COMMON_BLOCKS = YES; 305 | GCC_OPTIMIZATION_LEVEL = 0; 306 | GCC_PREPROCESSOR_DEFINITIONS = ( 307 | "DEBUG=1", 308 | "$(inherited)", 309 | ); 310 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 311 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 312 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 313 | GCC_WARN_UNDECLARED_SELECTOR = YES; 314 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 315 | GCC_WARN_UNUSED_FUNCTION = YES; 316 | GCC_WARN_UNUSED_VARIABLE = YES; 317 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 318 | MTL_ENABLE_DEBUG_INFO = YES; 319 | ONLY_ACTIVE_ARCH = YES; 320 | SDKROOT = iphoneos; 321 | TARGETED_DEVICE_FAMILY = "1,2"; 322 | }; 323 | name = Debug; 324 | }; 325 | A9FE217B1B254A0B0058D2C1 /* Release */ = { 326 | isa = XCBuildConfiguration; 327 | buildSettings = { 328 | ALWAYS_SEARCH_USER_PATHS = NO; 329 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 330 | CLANG_CXX_LIBRARY = "libc++"; 331 | CLANG_ENABLE_MODULES = YES; 332 | CLANG_ENABLE_OBJC_ARC = YES; 333 | CLANG_WARN_BOOL_CONVERSION = YES; 334 | CLANG_WARN_CONSTANT_CONVERSION = YES; 335 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 336 | CLANG_WARN_EMPTY_BODY = YES; 337 | CLANG_WARN_ENUM_CONVERSION = YES; 338 | CLANG_WARN_INT_CONVERSION = YES; 339 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 340 | CLANG_WARN_UNREACHABLE_CODE = YES; 341 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 342 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 343 | COPY_PHASE_STRIP = NO; 344 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 345 | ENABLE_NS_ASSERTIONS = NO; 346 | ENABLE_STRICT_OBJC_MSGSEND = YES; 347 | GCC_C_LANGUAGE_STANDARD = gnu99; 348 | GCC_NO_COMMON_BLOCKS = YES; 349 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 350 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 351 | GCC_WARN_UNDECLARED_SELECTOR = YES; 352 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 353 | GCC_WARN_UNUSED_FUNCTION = YES; 354 | GCC_WARN_UNUSED_VARIABLE = YES; 355 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 356 | MTL_ENABLE_DEBUG_INFO = NO; 357 | SDKROOT = iphoneos; 358 | TARGETED_DEVICE_FAMILY = "1,2"; 359 | VALIDATE_PRODUCT = YES; 360 | }; 361 | name = Release; 362 | }; 363 | A9FE217D1B254A0B0058D2C1 /* Debug */ = { 364 | isa = XCBuildConfiguration; 365 | buildSettings = { 366 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 367 | INFOPLIST_FILE = KSToastViewDemo/Info.plist; 368 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 369 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 370 | PRODUCT_BUNDLE_IDENTIFIER = "me.c0ming.$(PRODUCT_NAME:rfc1034identifier)"; 371 | PRODUCT_NAME = "$(TARGET_NAME)"; 372 | TARGETED_DEVICE_FAMILY = "1,2"; 373 | }; 374 | name = Debug; 375 | }; 376 | A9FE217E1B254A0B0058D2C1 /* Release */ = { 377 | isa = XCBuildConfiguration; 378 | buildSettings = { 379 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 380 | INFOPLIST_FILE = KSToastViewDemo/Info.plist; 381 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 382 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 383 | PRODUCT_BUNDLE_IDENTIFIER = "me.c0ming.$(PRODUCT_NAME:rfc1034identifier)"; 384 | PRODUCT_NAME = "$(TARGET_NAME)"; 385 | TARGETED_DEVICE_FAMILY = "1,2"; 386 | }; 387 | name = Release; 388 | }; 389 | A9FE21801B254A0B0058D2C1 /* Debug */ = { 390 | isa = XCBuildConfiguration; 391 | buildSettings = { 392 | BUNDLE_LOADER = "$(TEST_HOST)"; 393 | FRAMEWORK_SEARCH_PATHS = ( 394 | "$(SDKROOT)/Developer/Library/Frameworks", 395 | "$(inherited)", 396 | ); 397 | GCC_PREPROCESSOR_DEFINITIONS = ( 398 | "DEBUG=1", 399 | "$(inherited)", 400 | ); 401 | INFOPLIST_FILE = KSToastViewDemoTests/Info.plist; 402 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 403 | PRODUCT_BUNDLE_IDENTIFIER = "me.c0ming.$(PRODUCT_NAME:rfc1034identifier)"; 404 | PRODUCT_NAME = "$(TARGET_NAME)"; 405 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/KSToastViewDemo.app/KSToastViewDemo"; 406 | }; 407 | name = Debug; 408 | }; 409 | A9FE21811B254A0B0058D2C1 /* Release */ = { 410 | isa = XCBuildConfiguration; 411 | buildSettings = { 412 | BUNDLE_LOADER = "$(TEST_HOST)"; 413 | FRAMEWORK_SEARCH_PATHS = ( 414 | "$(SDKROOT)/Developer/Library/Frameworks", 415 | "$(inherited)", 416 | ); 417 | INFOPLIST_FILE = KSToastViewDemoTests/Info.plist; 418 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 419 | PRODUCT_BUNDLE_IDENTIFIER = "me.c0ming.$(PRODUCT_NAME:rfc1034identifier)"; 420 | PRODUCT_NAME = "$(TARGET_NAME)"; 421 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/KSToastViewDemo.app/KSToastViewDemo"; 422 | }; 423 | name = Release; 424 | }; 425 | /* End XCBuildConfiguration section */ 426 | 427 | /* Begin XCConfigurationList section */ 428 | A9FE21541B254A0B0058D2C1 /* Build configuration list for PBXProject "KSToastViewDemo" */ = { 429 | isa = XCConfigurationList; 430 | buildConfigurations = ( 431 | A9FE217A1B254A0B0058D2C1 /* Debug */, 432 | A9FE217B1B254A0B0058D2C1 /* Release */, 433 | ); 434 | defaultConfigurationIsVisible = 0; 435 | defaultConfigurationName = Release; 436 | }; 437 | A9FE217C1B254A0B0058D2C1 /* Build configuration list for PBXNativeTarget "KSToastViewDemo" */ = { 438 | isa = XCConfigurationList; 439 | buildConfigurations = ( 440 | A9FE217D1B254A0B0058D2C1 /* Debug */, 441 | A9FE217E1B254A0B0058D2C1 /* Release */, 442 | ); 443 | defaultConfigurationIsVisible = 0; 444 | defaultConfigurationName = Release; 445 | }; 446 | A9FE217F1B254A0B0058D2C1 /* Build configuration list for PBXNativeTarget "KSToastViewDemoTests" */ = { 447 | isa = XCConfigurationList; 448 | buildConfigurations = ( 449 | A9FE21801B254A0B0058D2C1 /* Debug */, 450 | A9FE21811B254A0B0058D2C1 /* Release */, 451 | ); 452 | defaultConfigurationIsVisible = 0; 453 | defaultConfigurationName = Release; 454 | }; 455 | /* End XCConfigurationList section */ 456 | }; 457 | rootObject = A9FE21511B254A0B0058D2C1 /* Project object */; 458 | } 459 | -------------------------------------------------------------------------------- /KSToastViewDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /KSToastViewDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // KSToastViewDemo 4 | // 5 | // Created by c0ming on 6/8/15. 6 | // Copyright (c) 2015 c0ming. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /KSToastViewDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // KSToastViewDemo 4 | // 5 | // Created by c0ming on 6/8/15. 6 | // Copyright (c) 2015 c0ming. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | #import "KSToastView.h" 12 | 13 | @interface AppDelegate () 14 | 15 | @end 16 | 17 | @implementation AppDelegate 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 20 | [KSToastView ks_setAppearanceTextFont:[UIFont boldSystemFontOfSize:17.0f]]; 21 | [KSToastView ks_setAppearanceMaxWidth:CGRectGetWidth([UIScreen mainScreen].bounds) - 64.0f]; 22 | [KSToastView ks_setAppearanceOffsetBottom:76.0]; 23 | [KSToastView ks_setAppearanceMaxLines:2]; 24 | return YES; 25 | } 26 | 27 | - (void)applicationWillResignActive:(UIApplication *)application { 28 | // 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. 29 | // 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. 30 | } 31 | 32 | - (void)applicationDidEnterBackground:(UIApplication *)application { 33 | // 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. 34 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 35 | } 36 | 37 | - (void)applicationWillEnterForeground:(UIApplication *)application { 38 | // 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. 39 | } 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // 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. 43 | } 44 | 45 | - (void)applicationWillTerminate:(UIApplication *)application { 46 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /KSToastViewDemo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /KSToastViewDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /KSToastViewDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /KSToastViewDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /KSToastViewDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // KSToastViewDemo 4 | // 5 | // Created by c0ming on 6/8/15. 6 | // Copyright (c) 2015 c0ming. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UICollectionViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /KSToastViewDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // KSToastViewDemo 4 | // 5 | // Created by c0ming on 6/8/15. 6 | // Copyright (c) 2015 c0ming. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | #import "KSToastView.h" 12 | 13 | @interface ViewController () 14 | 15 | @end 16 | 17 | @implementation ViewController 18 | 19 | static NSString *const reuseIdentifier = @"Cell"; 20 | 21 | - (IBAction)showAction:(UIBarButtonItem *)sender { 22 | [KSToastView ks_showToast:@"Across the Great Wall we can reach every corner in the world." duration:4.0f completion: ^{ 23 | [KSToastView ks_showToast:@"Game Over!" delay:0.5f]; 24 | }]; 25 | } 26 | 27 | - (void)viewDidLoad { 28 | [super viewDidLoad]; 29 | 30 | [self.collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:reuseIdentifier]; 31 | } 32 | 33 | - (void)didReceiveMemoryWarning { 34 | [super didReceiveMemoryWarning]; 35 | } 36 | 37 | #pragma mark 38 | 39 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { 40 | return 100; 41 | } 42 | 43 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { 44 | UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath]; 45 | cell.backgroundColor = [UIColor groupTableViewBackgroundColor]; 46 | return cell; 47 | } 48 | 49 | - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { 50 | UICollectionViewCell *cell = [collectionView cellForItemAtIndexPath:indexPath]; 51 | 52 | [KSToastView ks_showToast:cell duration:2.0f]; 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /KSToastViewDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // KSToastViewDemo 4 | // 5 | // Created by c0ming on 6/8/15. 6 | // Copyright (c) 2015 c0ming. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /KSToastViewDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /KSToastViewDemoTests/KSToastViewDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // KSToastViewDemoTests.m 3 | // KSToastViewDemoTests 4 | // 5 | // Created by c0ming on 6/8/15. 6 | // Copyright (c) 2015 c0ming. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface KSToastViewDemoTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation KSToastViewDemoTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 c0ming ( https://github.com/c0ming ) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### KSToastView 2 | 3 | Simple Popup Notification inspired by [Android Toast Widget](http://developer.android.com/intl/zh-cn/guide/topics/ui/notifiers/toasts.html). 4 | 5 | ![ScreenShot](./ScreenShot/ScreenShot.gif) 6 | 7 | ### KSToastView Configure 8 | ``` 9 | + (void)ks_setAppearanceBackgroundColor:(UIColor *)backgroundColor; 10 | + (void)ks_setAppearanceCornerRadius:(CGFloat)cornerRadius; 11 | + (void)ks_setAppearanceMaxWidth:(CGFloat)maxWidth; 12 | + (void)ks_setAppearanceMaxLines:(NSInteger)maxLines; 13 | + (void)ks_setAppearanceOffsetBottom:(CGFloat)offsetBottom; 14 | + (void)ks_setAppearanceTextAligment:(NSTextAlignment)textAlignment; 15 | + (void)ks_setAppearanceTextColor:(UIColor *)textColor; 16 | + (void)ks_setAppearanceTextFont:(UIFont *)textFont; 17 | + (void)ks_setAppearanceTextInsets:(UIEdgeInsets)textInsets; 18 | + (void)ks_setToastViewShowDuration:(NSTimeInterval)duration; 19 | ``` 20 | ### KSToastView Show 21 | ``` 22 | + (void)ks_showToast:(id)toast; 23 | + (void)ks_showToast:(id)toast duration:(NSTimeInterval)duration; 24 | + (void)ks_showToast:(id)toast delay:(NSTimeInterval)delay; 25 | + (void)ks_showToast:(id)toast completion:(KSToastBlock)completion; 26 | + (void)ks_showToast:(id)toast duration:(NSTimeInterval)duration delay:(NSTimeInterval)delay; 27 | + (void)ks_showToast:(id)toast duration:(NSTimeInterval)duration completion:(KSToastBlock)completion; 28 | + (void)ks_showToast:(id)toast delay:(NSTimeInterval)delay completion:(KSToastBlock)completion; 29 | + (void)ks_showToast:(id)toast duration:(NSTimeInterval)duration delay:(NSTimeInterval)delay completion:(KSToastBlock)completion; 30 | ``` 31 | 32 | ### Usage 33 | ``` 34 | /// show NSString 35 | [KSToastView ks_showToast:@"Across the Great Wall we can reach every corner in the world."]; 36 | 37 | /// show NSObject description with 2 seconds. 38 | [KSToastView ks_showToast:self duration:2.0f]; 39 | 40 | /// show with a completion block. 41 | [KSToastView ks_showToast:@"Start" duration:3.0f completion:^{ 42 | NSLog(@"%@", @"End!"); 43 | }]; 44 | ``` 45 | 46 | ### Installation 47 | Just add KSToastView.h/m files to your Project, 48 | 49 | or use [CocoaPods](https://cocoapods.org). 50 | ``` 51 | pod 'KSToastView', '0.5.7' 52 | ``` 53 | 54 | 55 | ### License 56 | [The MIT License (MIT)](./LICENSE) 57 | -------------------------------------------------------------------------------- /ScreenShot/ScreenShot.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/c0ming/KSToastView/32d58bf1a352816d4d6c8700972fe39b37edfd56/ScreenShot/ScreenShot.gif --------------------------------------------------------------------------------