├── .gitignore ├── D3Notice.podspec ├── D3Notice.swift ├── D3Notice.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── D3Notice.xccheckout ├── D3Notice ├── AppDelegate.swift ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist └── ViewController.swift ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | ###################### 3 | *.pbxuser 4 | !default.pbxuser 5 | *.mode1v3 6 | !default.mode1v3 7 | *.mode2v3 8 | !default.mode2v3 9 | *.perspectivev3 10 | !default.perspectivev3 11 | *.xcworkspace 12 | !default.xcworkspace 13 | xcuserdata 14 | *.moved-aside 15 | DerivedData 16 | */Pods/* 17 | 18 | # Cocoapods 19 | ###################### 20 | Pods/ 21 | Podfile.lock 22 | 23 | # OS generated files # 24 | ###################### 25 | .DS_Store* 26 | ehthumbs.db 27 | Icon? 28 | Thumbs.db 29 | -------------------------------------------------------------------------------- /D3Notice.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'D3Notice' 3 | s.version = '1.1.1' 4 | s.license = { :type => "MIT", :file => 'LICENSE' } 5 | s.homepage = 'https://github.com/mozhenhau/D3Notice' 6 | s.authors = {"mozhenhau" => "493842062@qq.com"} 7 | s.summary = 'D3Notice, swift alertview' 8 | s.source = {:git => 'https://github.com/mozhenhau/D3Notice.git', :tag => '1.1.1' } 9 | s.source_files = 'D3Notice.swift' 10 | s.requires_arc = true 11 | s.ios.deployment_target = '8.0' 12 | end 13 | 14 | 15 | -------------------------------------------------------------------------------- /D3Notice.swift: -------------------------------------------------------------------------------- 1 | // 2 | // D3Notice.swift 3 | // D3Notice 4 | // 5 | // Created by mozhenhau on 15/6/11. 6 | // Copyright (c) 2015年 mozhenhau. All rights reserved. 7 | // 显示最后一个 8 | // 9 | import Foundation 10 | import UIKit 11 | 12 | extension UIViewController { 13 | //MARK:suc,3秒自动消失 14 | func showNoticeSuc(text: String) { 15 | D3NoticeManager.sharedInstance.showNoticeWithText(NoticeType.Success, text: text,time: D3NoticeManager.longTime, autoClear: true) 16 | } 17 | 18 | func showNoticeSuc(text: String,time:NSTimeInterval, autoClear: Bool) { 19 | D3NoticeManager.sharedInstance.showNoticeWithText(NoticeType.Success, text: text,time: time, autoClear: autoClear) 20 | } 21 | 22 | //MARK:err 23 | func showNoticeErr(text: String) { 24 | D3NoticeManager.sharedInstance.showNoticeWithText(NoticeType.Error, text: text,time: D3NoticeManager.longTime, autoClear: true) 25 | } 26 | func showNoticeErr(text: String,time:NSTimeInterval, autoClear: Bool) { 27 | D3NoticeManager.sharedInstance.showNoticeWithText(NoticeType.Error, text: text, time:time,autoClear: autoClear) 28 | } 29 | 30 | //MARK:info 31 | func showNoticeInfo(text: String) { 32 | D3NoticeManager.sharedInstance.showNoticeWithText(NoticeType.Info, text: text, time: D3NoticeManager.longTime,autoClear: true) 33 | } 34 | func showNoticeInfo(text: String,time:NSTimeInterval, autoClear: Bool) { 35 | D3NoticeManager.sharedInstance.showNoticeWithText(NoticeType.Info, text: text, time: time,autoClear: autoClear) 36 | } 37 | 38 | //MARK:wait 不自动消失 39 | func showNoticeWait() { 40 | D3NoticeManager.sharedInstance.showWait(D3NoticeManager.longTime,autoClear: false) 41 | } 42 | 43 | func showNoticeWaitAuto(time:NSTimeInterval){ 44 | D3NoticeManager.sharedInstance.showWait(time,autoClear: true) 45 | } 46 | 47 | //MARK:纯text 48 | func showNoticeText(text: String) { 49 | D3NoticeManager.sharedInstance.showText(text,time:D3NoticeManager.longTime,autoClear:true) 50 | } 51 | 52 | func showNoticeText(text: String,time:NSTimeInterval,autoClear:Bool) { 53 | D3NoticeManager.sharedInstance.showText(text,time:time,autoClear:true) 54 | } 55 | 56 | //MARK:进度 57 | func showProgressView(progress:Double){ 58 | D3NoticeManager.sharedInstance.showProgressView(progress, type: NoticeType.CircleProgress) 59 | } 60 | 61 | 62 | func showProgressView(progress:Double,type:NoticeType){ 63 | D3NoticeManager.sharedInstance.showProgressView(progress, type: type) 64 | } 65 | 66 | 67 | //MARK:clear 68 | func clearAllNotice() { 69 | D3NoticeManager.sharedInstance.clearNotice() 70 | } 71 | 72 | func clearAllProgress(){ 73 | D3NoticeManager.sharedInstance.clearProgress() 74 | } 75 | 76 | func clearAll(){ 77 | D3NoticeManager.sharedInstance.clearAll() 78 | } 79 | 80 | //clear wait 81 | func clearWaitNotice(){ 82 | D3NoticeManager.sharedInstance.clearWait() 83 | } 84 | } 85 | 86 | 87 | enum NoticeType:Int{ 88 | case Success = 888 89 | case Error 90 | case Info 91 | case OnlyText 92 | case Wait 93 | case CircleProgress = 989 94 | case LineProgress 95 | } 96 | 97 | typealias NoticeCompleteBlock = (() -> Void)? 98 | typealias NoticeTextBlock = ((String?) -> Void)? 99 | typealias NoticeDateBlock = ((NSDate?) -> Void)? 100 | //MARK:通知管理类,对应每种类型只会生成一次,不作移除,隐藏在window 101 | class D3NoticeManager: NSObject { 102 | private var notices = Array() //提示性 103 | private var window:UIWindow! = UIApplication.sharedApplication().keyWindow! 104 | static let longTime:NSTimeInterval = 2 105 | static let shortTime:NSTimeInterval = 1 106 | 107 | static let sharedInstance = D3NoticeManager() 108 | private override init() {} 109 | 110 | //菊花图 111 | func showWait(time:NSTimeInterval,autoClear: Bool) { 112 | clearNotice() 113 | for view in notices{ 114 | if view.tag == NoticeType.Wait.rawValue{ 115 | showNotice(view, time: time, autoClear: autoClear) 116 | return 117 | } 118 | } 119 | 120 | addNotice(D3NoticeView(type: NoticeType.Wait), time: time, autoClear: autoClear) 121 | } 122 | 123 | //仅文字 124 | func showText(text: String,time:NSTimeInterval,autoClear: Bool) { 125 | clearNotice() 126 | for view in notices{ 127 | if view.tag == NoticeType.OnlyText.rawValue{ 128 | let noticeView = view as! D3NoticeView 129 | 130 | noticeView.setTextContent(text) 131 | noticeView.center = window.center 132 | showNotice(view, time: time, autoClear: autoClear) 133 | return 134 | } 135 | } 136 | 137 | addNotice(D3NoticeView(text: text), time: time, autoClear: autoClear) 138 | } 139 | 140 | 141 | 142 | //有勾、叉和警告 143 | func showNoticeWithText(type: NoticeType,text: String,time:NSTimeInterval,autoClear: Bool) { 144 | clearNotice() 145 | for view in notices{ 146 | if view.tag == type.rawValue{ 147 | let noticeView = view as! D3NoticeView 148 | noticeView.setContent(type, text: text) 149 | noticeView.center = window.center 150 | showNotice(view, time: time, autoClear: autoClear) 151 | return 152 | } 153 | } 154 | addNotice(D3NoticeView(type: type,text: text), time: time, autoClear: autoClear) 155 | } 156 | 157 | //进度 158 | func showProgressView(progress:Double,type:NoticeType){ 159 | for view in notices{ 160 | if view.tag == NoticeType.CircleProgress.rawValue{ 161 | let noticeView = view as! D3ProgressView 162 | noticeView.type = type 163 | noticeView.changeProgress(progress) 164 | showNotice(view, time: 0, autoClear: false) 165 | return 166 | } 167 | } 168 | addNotice(D3ProgressView(type: type), time: 0, autoClear: false) 169 | } 170 | 171 | //窗口管理 172 | func addNotice(mainView:UIView,time:NSTimeInterval,autoClear:Bool){ 173 | if window == nil{ 174 | self.window = UIApplication.sharedApplication().keyWindow! 175 | } 176 | 177 | mainView.center = window.center 178 | mainView.layer.zPosition = 9999999 179 | window.addSubview(mainView) 180 | notices.append(mainView) 181 | if autoClear { 182 | NSTimer.scheduledTimerWithTimeInterval(time, target: self, selector: "hideNotice:", userInfo: mainView, repeats: false) 183 | } 184 | } 185 | 186 | 187 | func showNotice(mainView:UIView,time:NSTimeInterval,autoClear:Bool){ 188 | mainView.hidden = false 189 | if autoClear { 190 | NSTimer.scheduledTimerWithTimeInterval(time, target: self, selector: "hideNotice:", userInfo: mainView, repeats: false) 191 | } 192 | } 193 | 194 | 195 | func hideNotice(sender: NSTimer) { 196 | if let noticeView = sender.userInfo as? UIView { 197 | noticeView.hidden = true 198 | } 199 | } 200 | 201 | 202 | func clearAll() { 203 | for view in notices { 204 | view.hidden = true 205 | } 206 | } 207 | 208 | func clearNotice() { 209 | for view in notices { 210 | if view.tag >= NoticeType.Success.rawValue && view.tag <= NoticeType.Wait.rawValue{ 211 | view.hidden = true 212 | } 213 | } 214 | } 215 | 216 | func clearProgress() { 217 | for view in notices { 218 | if view.tag >= NoticeType.CircleProgress.rawValue{ 219 | view.hidden = true 220 | } 221 | } 222 | } 223 | 224 | func clearWait(){ 225 | self.clear(NoticeType.Wait) 226 | } 227 | 228 | 229 | func clear(type:NoticeType){ 230 | for view in notices { 231 | if view.tag == type.rawValue{ 232 | view.hidden = true 233 | } 234 | } 235 | } 236 | } 237 | 238 | 239 | class D3NoticeView:UIView{ 240 | var label:UILabel! 241 | var checkmarkView:UIImageView! 242 | 243 | convenience init(type:NoticeType){ 244 | self.init() 245 | self.frame = CGRectMake(0, 0, 78, 78) 246 | self.layer.cornerRadius = 10 247 | self.backgroundColor = UIColor(red:0, green:0, blue:0, alpha: 0.8) 248 | 249 | let ai = UIActivityIndicatorView(activityIndicatorStyle: UIActivityIndicatorViewStyle.WhiteLarge) 250 | ai.frame = CGRectMake(21, 21, 36, 36) 251 | ai.startAnimating() 252 | self.addSubview(ai) 253 | self.tag = type.rawValue 254 | } 255 | 256 | 257 | convenience init(text:String){ 258 | self.init() 259 | self.layer.cornerRadius = 12 260 | self.backgroundColor = UIColor(red:0, green:0, blue:0, alpha: 0.8) 261 | 262 | label = UILabel() 263 | label.text = text 264 | label.numberOfLines = 0 265 | label.font = UIFont.systemFontOfSize(13) 266 | label.textAlignment = NSTextAlignment.Center 267 | label.textColor = UIColor.whiteColor() 268 | label.sizeToFix() 269 | self.addSubview(label) 270 | self.frame = CGRectMake(0, 0, label.frame.width + 50 , label.frame.height + 30) 271 | 272 | label.center = CGPointMake(self.frame.width/2, self.frame.height/2) 273 | self.tag = NoticeType.OnlyText.rawValue 274 | } 275 | 276 | convenience init(type:NoticeType,text:String){ 277 | self.init() 278 | self.frame = CGRectMake(0, 0, 90, 90) 279 | self.layer.cornerRadius = 10 280 | self.backgroundColor = UIColor(red:0, green:0, blue:0, alpha: 0.7) 281 | 282 | checkmarkView = UIImageView(frame:CGRectMake(27, 15, 36, 36)) 283 | self.addSubview(checkmarkView) 284 | 285 | label = UILabel(frame: CGRectMake(0, 60, 90, 16)) 286 | label.font = UIFont.systemFontOfSize(13) 287 | label.textColor = UIColor.whiteColor() 288 | label.textAlignment = NSTextAlignment.Center 289 | self.addSubview(label) 290 | self.tag = type.rawValue 291 | self.setContent(type, text: text) 292 | } 293 | 294 | 295 | func setContent(type: NoticeType,text:String){ 296 | checkmarkView.image = self.draw(type) 297 | label.text = text 298 | label.sizeToFixWidth() 299 | 300 | let mainViewWidth:CGFloat = label.frame.width + 50 > 90 ? label.frame.width + 50.0 : 90 301 | 302 | self.frame = CGRectMake(0, 0, mainViewWidth , self.frame.height) 303 | checkmarkView.center.x = self.frame.width/2 304 | label.center.x = self.frame.width/2 305 | } 306 | 307 | func setTextContent(text:String){ 308 | label.text = text 309 | label.sizeToFix() 310 | 311 | self.frame = CGRectMake(0, 0, label.frame.width + 50 , label.frame.height + 30) 312 | label.center.x = self.frame.width/2 313 | } 314 | 315 | 316 | //下面是画图的 317 | func draw(type: NoticeType)->UIImage!{ 318 | var image:UIImage! 319 | UIGraphicsBeginImageContextWithOptions(CGSizeMake(36, 36), false, 0) 320 | let checkmarkShapePath = UIBezierPath() 321 | 322 | // 先画个圈圈 323 | checkmarkShapePath.moveToPoint(CGPointMake(36, 18)) 324 | checkmarkShapePath.addArcWithCenter(CGPointMake(18, 18), radius: 17.5, startAngle: 0, endAngle: CGFloat(M_PI*2), clockwise: true) 325 | checkmarkShapePath.closePath() 326 | 327 | switch type { 328 | case .Success: // 画勾 329 | checkmarkShapePath.moveToPoint(CGPointMake(10, 18)) 330 | checkmarkShapePath.addLineToPoint(CGPointMake(16, 24)) 331 | checkmarkShapePath.addLineToPoint(CGPointMake(27, 13)) 332 | checkmarkShapePath.moveToPoint(CGPointMake(10, 18)) 333 | checkmarkShapePath.closePath() 334 | case .Error: // 画叉 335 | checkmarkShapePath.moveToPoint(CGPointMake(10, 10)) 336 | checkmarkShapePath.addLineToPoint(CGPointMake(26, 26)) 337 | checkmarkShapePath.moveToPoint(CGPointMake(10, 26)) 338 | checkmarkShapePath.addLineToPoint(CGPointMake(26, 10)) 339 | checkmarkShapePath.moveToPoint(CGPointMake(10, 10)) 340 | checkmarkShapePath.closePath() 341 | case .Info: //画警告 342 | checkmarkShapePath.moveToPoint(CGPointMake(18, 6)) 343 | checkmarkShapePath.addLineToPoint(CGPointMake(18, 22)) 344 | checkmarkShapePath.moveToPoint(CGPointMake(18, 6)) 345 | checkmarkShapePath.closePath() 346 | 347 | UIColor.whiteColor().setStroke() 348 | checkmarkShapePath.stroke() 349 | 350 | let checkmarkShapePath = UIBezierPath() 351 | checkmarkShapePath.moveToPoint(CGPointMake(18, 27)) 352 | checkmarkShapePath.addArcWithCenter(CGPointMake(18, 27), radius: 1, startAngle: 0, endAngle: CGFloat(M_PI*2), clockwise: true) 353 | checkmarkShapePath.closePath() 354 | 355 | UIColor.whiteColor().setFill() 356 | checkmarkShapePath.fill() 357 | 358 | default: 359 | break 360 | } 361 | 362 | UIColor.whiteColor().setStroke() 363 | checkmarkShapePath.stroke() 364 | image = UIGraphicsGetImageFromCurrentImageContext() 365 | UIGraphicsEndImageContext() 366 | return image 367 | } 368 | } 369 | 370 | 371 | 372 | //进度 373 | class D3ProgressView: UIView { 374 | var label:UILabel! 375 | var progress:Double = 0 376 | var type:NoticeType = NoticeType.CircleProgress 377 | 378 | convenience init(type:NoticeType){ 379 | self.init() 380 | self.type = type 381 | self.tag = NoticeType.CircleProgress.rawValue 382 | self.frame = CGRectMake(0, 0, 90, 90) 383 | self.layer.cornerRadius = 10 384 | self.clipsToBounds = true 385 | self.backgroundColor = UIColor(red:0, green:0, blue:0, alpha: 0.7) 386 | 387 | label = UILabel(frame: CGRectMake(0, 0, 90, 90)) 388 | label?.textAlignment = NSTextAlignment.Center 389 | label?.textColor = UIColor.whiteColor() 390 | label?.font = UIFont.systemFontOfSize(13) 391 | label?.text = "0.0%" 392 | self.addSubview(label!) 393 | } 394 | 395 | func changeProgress(progress:Double){ 396 | self.progress = progress > 1 ? 1 : progress 397 | label?.text = "\(NSString(format:"%.1f",self.progress*100))%" 398 | self.setNeedsDisplay() 399 | } 400 | 401 | override func drawRect(rect: CGRect) { 402 | switch type{ 403 | case .LineProgress: 404 | label.frame = CGRectMake(0,0,90,75) 405 | self.drawLine() 406 | 407 | default: 408 | self.drawCircle() 409 | } 410 | } 411 | 412 | 413 | private func drawCircle(){ 414 | UIColor.whiteColor().setFill() 415 | let ctx = UIGraphicsGetCurrentContext() 416 | //拼接路径 417 | let center = CGPointMake(45, 45) 418 | let radius:CGFloat = 30 419 | let startA = CGFloat(-M_PI_2); 420 | let endA = CGFloat(-M_PI_2 + progress * M_PI * 2) 421 | let path = UIBezierPath(arcCenter: center, radius: radius, startAngle: startA, endAngle: endA, clockwise: true) 422 | CGContextSetLineCap(ctx, CGLineCap.Round) 423 | CGContextSetLineWidth(ctx, 4); 424 | UIColor.whiteColor().set() 425 | CGContextAddPath(ctx, path.CGPath); 426 | CGContextStrokePath(ctx); 427 | } 428 | 429 | private func drawLine(){ 430 | let context = UIGraphicsGetCurrentContext() 431 | 432 | // save the context 433 | CGContextSaveGState(context) ; 434 | 435 | // allow antialiasing 436 | CGContextSetAllowsAntialiasing(context, true) 437 | 438 | // we first draw the outter rounded rectangle 439 | let lineRect = CGRectMake(10, 55, 70, 16) 440 | var rect = CGRectInset(lineRect, 1.0, 1.0) 441 | var radius = 0.5 * rect.size.height 442 | 443 | UIColor.whiteColor().setStroke() 444 | CGContextSetLineWidth(context, 1.0) 445 | 446 | CGContextBeginPath(context) ; 447 | CGContextMoveToPoint(context, CGRectGetMinX(rect), CGRectGetMidY(rect)) ; 448 | CGContextAddArcToPoint(context, CGRectGetMinX(rect), CGRectGetMinY(rect), CGRectGetMidX(rect), CGRectGetMinY(rect), radius) ; 449 | CGContextAddArcToPoint(context, CGRectGetMaxX(rect), CGRectGetMinY(rect), CGRectGetMaxX(rect), CGRectGetMidY(rect), radius) ; 450 | CGContextAddArcToPoint(context, CGRectGetMaxX(rect), CGRectGetMaxY(rect), CGRectGetMidX(rect), CGRectGetMaxY(rect), radius) ; 451 | CGContextAddArcToPoint(context, CGRectGetMinX(rect), CGRectGetMaxY(rect), CGRectGetMinX(rect), CGRectGetMidY(rect), radius) ; 452 | CGContextClosePath(context) ; 453 | CGContextDrawPath(context, .Stroke) 454 | 455 | // draw the empty rounded rectangle (shown for the "unfilled" portions of the progress 456 | rect = CGRectInset(lineRect, 3.0, 3.0) 457 | radius = 0.5 * rect.size.height 458 | 459 | UIColor.clearColor().setFill() 460 | 461 | CGContextBeginPath(context) ; 462 | CGContextMoveToPoint(context, CGRectGetMinX(rect), CGRectGetMidY(rect)) ; 463 | CGContextAddArcToPoint(context, CGRectGetMinX(rect), CGRectGetMinY(rect), CGRectGetMidX(rect), CGRectGetMinY(rect), radius) ; 464 | CGContextAddArcToPoint(context, CGRectGetMaxX(rect), CGRectGetMinY(rect), CGRectGetMaxX(rect), CGRectGetMidY(rect), radius) ; 465 | CGContextAddArcToPoint(context, CGRectGetMaxX(rect), CGRectGetMaxY(rect), CGRectGetMidX(rect), CGRectGetMaxY(rect), radius) ; 466 | CGContextAddArcToPoint(context, CGRectGetMinX(rect), CGRectGetMaxY(rect), CGRectGetMinX(rect), CGRectGetMidY(rect), radius) ; 467 | CGContextClosePath(context) ; 468 | CGContextFillPath(context) ; 469 | 470 | // draw the inside moving filled rounded rectangle 471 | radius = 0.5 * rect.size.height ; 472 | 473 | // make sure the filled rounded rectangle is not smaller than 2 times the radius 474 | rect.size.width *= CGFloat(progress) 475 | if (rect.size.width < 2 * radius){ 476 | rect.size.width = 2 * radius 477 | } 478 | 479 | UIColor.whiteColor().setFill() 480 | 481 | CGContextBeginPath(context) ; 482 | CGContextMoveToPoint(context, CGRectGetMinX(rect), CGRectGetMidY(rect)) ; 483 | CGContextAddArcToPoint(context, CGRectGetMinX(rect), CGRectGetMinY(rect), CGRectGetMidX(rect), CGRectGetMinY(rect), radius) ; 484 | CGContextAddArcToPoint(context, CGRectGetMaxX(rect), CGRectGetMinY(rect), CGRectGetMaxX(rect), CGRectGetMidY(rect), radius) ; 485 | CGContextAddArcToPoint(context, CGRectGetMaxX(rect), CGRectGetMaxY(rect), CGRectGetMidX(rect), CGRectGetMaxY(rect), radius) ; 486 | CGContextAddArcToPoint(context, CGRectGetMinX(rect), CGRectGetMaxY(rect), CGRectGetMinX(rect), CGRectGetMidY(rect), radius) ; 487 | CGContextClosePath(context) ; 488 | CGContextFillPath(context) ; 489 | 490 | // restore the context 491 | CGContextRestoreGState(context) ; 492 | } 493 | 494 | } 495 | 496 | 497 | extension UILabel{ 498 | func sizeToFixWidth(){ 499 | let fitString = self.text! as NSString 500 | let maxSize = CGSizeMake(CGFloat.max, self.bounds.height) 501 | let fitWidth = fitString.boundingRectWithSize(maxSize, options: NSStringDrawingOptions.UsesFontLeading, attributes: [NSFontAttributeName:self.font], context: nil).width 502 | self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, fitWidth, self.frame.height) 503 | } 504 | 505 | func sizeToFix(){ 506 | let fitString = self.text! as NSString 507 | let maxSize = CGSizeMake(CGFloat.max, self.bounds.height) 508 | let fitSize = fitString.boundingRectWithSize(maxSize, options: NSStringDrawingOptions.UsesFontLeading, attributes: [NSFontAttributeName:self.font], context: nil) 509 | self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, fitSize.width, fitSize.height) 510 | } 511 | 512 | } -------------------------------------------------------------------------------- /D3Notice.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | A53113831B2995140087452E /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A53113821B2995140087452E /* AppDelegate.swift */; }; 11 | A53113851B2995140087452E /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A53113841B2995140087452E /* ViewController.swift */; }; 12 | A53113881B2995140087452E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A53113861B2995140087452E /* Main.storyboard */; }; 13 | A531138A1B2995140087452E /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A53113891B2995140087452E /* Images.xcassets */; }; 14 | A531138D1B2995140087452E /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = A531138B1B2995140087452E /* LaunchScreen.xib */; }; 15 | A53113A31B2995410087452E /* D3Notice.swift in Sources */ = {isa = PBXBuildFile; fileRef = A53113A21B2995410087452E /* D3Notice.swift */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | A531137D1B2995140087452E /* D3Notice.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = D3Notice.app; sourceTree = BUILT_PRODUCTS_DIR; }; 20 | A53113811B2995140087452E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 21 | A53113821B2995140087452E /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 22 | A53113841B2995140087452E /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 23 | A53113871B2995140087452E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 24 | A53113891B2995140087452E /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 25 | A531138C1B2995140087452E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 26 | A53113A21B2995410087452E /* D3Notice.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = D3Notice.swift; sourceTree = ""; }; 27 | /* End PBXFileReference section */ 28 | 29 | /* Begin PBXFrameworksBuildPhase section */ 30 | A531137A1B2995140087452E /* Frameworks */ = { 31 | isa = PBXFrameworksBuildPhase; 32 | buildActionMask = 2147483647; 33 | files = ( 34 | ); 35 | runOnlyForDeploymentPostprocessing = 0; 36 | }; 37 | /* End PBXFrameworksBuildPhase section */ 38 | 39 | /* Begin PBXGroup section */ 40 | A53113741B2995140087452E = { 41 | isa = PBXGroup; 42 | children = ( 43 | A53113A21B2995410087452E /* D3Notice.swift */, 44 | A531137F1B2995140087452E /* D3Notice */, 45 | A531137E1B2995140087452E /* Products */, 46 | ); 47 | sourceTree = ""; 48 | }; 49 | A531137E1B2995140087452E /* Products */ = { 50 | isa = PBXGroup; 51 | children = ( 52 | A531137D1B2995140087452E /* D3Notice.app */, 53 | ); 54 | name = Products; 55 | sourceTree = ""; 56 | }; 57 | A531137F1B2995140087452E /* D3Notice */ = { 58 | isa = PBXGroup; 59 | children = ( 60 | A53113821B2995140087452E /* AppDelegate.swift */, 61 | A53113841B2995140087452E /* ViewController.swift */, 62 | A53113861B2995140087452E /* Main.storyboard */, 63 | A53113891B2995140087452E /* Images.xcassets */, 64 | A531138B1B2995140087452E /* LaunchScreen.xib */, 65 | A53113801B2995140087452E /* Supporting Files */, 66 | ); 67 | path = D3Notice; 68 | sourceTree = ""; 69 | }; 70 | A53113801B2995140087452E /* Supporting Files */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | A53113811B2995140087452E /* Info.plist */, 74 | ); 75 | name = "Supporting Files"; 76 | sourceTree = ""; 77 | }; 78 | /* End PBXGroup section */ 79 | 80 | /* Begin PBXNativeTarget section */ 81 | A531137C1B2995140087452E /* D3Notice */ = { 82 | isa = PBXNativeTarget; 83 | buildConfigurationList = A531139C1B2995150087452E /* Build configuration list for PBXNativeTarget "D3Notice" */; 84 | buildPhases = ( 85 | A53113791B2995140087452E /* Sources */, 86 | A531137A1B2995140087452E /* Frameworks */, 87 | A531137B1B2995140087452E /* Resources */, 88 | ); 89 | buildRules = ( 90 | ); 91 | dependencies = ( 92 | ); 93 | name = D3Notice; 94 | productName = D3Notice; 95 | productReference = A531137D1B2995140087452E /* D3Notice.app */; 96 | productType = "com.apple.product-type.application"; 97 | }; 98 | /* End PBXNativeTarget section */ 99 | 100 | /* Begin PBXProject section */ 101 | A53113751B2995140087452E /* Project object */ = { 102 | isa = PBXProject; 103 | attributes = { 104 | LastSwiftUpdateCheck = 0700; 105 | LastUpgradeCheck = 0700; 106 | ORGANIZATIONNAME = mozhenhau; 107 | TargetAttributes = { 108 | A531137C1B2995140087452E = { 109 | CreatedOnToolsVersion = 6.3.2; 110 | }; 111 | }; 112 | }; 113 | buildConfigurationList = A53113781B2995140087452E /* Build configuration list for PBXProject "D3Notice" */; 114 | compatibilityVersion = "Xcode 3.2"; 115 | developmentRegion = English; 116 | hasScannedForEncodings = 0; 117 | knownRegions = ( 118 | en, 119 | Base, 120 | ); 121 | mainGroup = A53113741B2995140087452E; 122 | productRefGroup = A531137E1B2995140087452E /* Products */; 123 | projectDirPath = ""; 124 | projectRoot = ""; 125 | targets = ( 126 | A531137C1B2995140087452E /* D3Notice */, 127 | ); 128 | }; 129 | /* End PBXProject section */ 130 | 131 | /* Begin PBXResourcesBuildPhase section */ 132 | A531137B1B2995140087452E /* Resources */ = { 133 | isa = PBXResourcesBuildPhase; 134 | buildActionMask = 2147483647; 135 | files = ( 136 | A53113881B2995140087452E /* Main.storyboard in Resources */, 137 | A531138D1B2995140087452E /* LaunchScreen.xib in Resources */, 138 | A531138A1B2995140087452E /* Images.xcassets in Resources */, 139 | ); 140 | runOnlyForDeploymentPostprocessing = 0; 141 | }; 142 | /* End PBXResourcesBuildPhase section */ 143 | 144 | /* Begin PBXSourcesBuildPhase section */ 145 | A53113791B2995140087452E /* Sources */ = { 146 | isa = PBXSourcesBuildPhase; 147 | buildActionMask = 2147483647; 148 | files = ( 149 | A53113851B2995140087452E /* ViewController.swift in Sources */, 150 | A53113831B2995140087452E /* AppDelegate.swift in Sources */, 151 | A53113A31B2995410087452E /* D3Notice.swift in Sources */, 152 | ); 153 | runOnlyForDeploymentPostprocessing = 0; 154 | }; 155 | /* End PBXSourcesBuildPhase section */ 156 | 157 | /* Begin PBXVariantGroup section */ 158 | A53113861B2995140087452E /* Main.storyboard */ = { 159 | isa = PBXVariantGroup; 160 | children = ( 161 | A53113871B2995140087452E /* Base */, 162 | ); 163 | name = Main.storyboard; 164 | sourceTree = ""; 165 | }; 166 | A531138B1B2995140087452E /* LaunchScreen.xib */ = { 167 | isa = PBXVariantGroup; 168 | children = ( 169 | A531138C1B2995140087452E /* Base */, 170 | ); 171 | name = LaunchScreen.xib; 172 | sourceTree = ""; 173 | }; 174 | /* End PBXVariantGroup section */ 175 | 176 | /* Begin XCBuildConfiguration section */ 177 | A531139A1B2995150087452E /* Debug */ = { 178 | isa = XCBuildConfiguration; 179 | buildSettings = { 180 | ALWAYS_SEARCH_USER_PATHS = NO; 181 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 182 | CLANG_CXX_LIBRARY = "libc++"; 183 | CLANG_ENABLE_MODULES = YES; 184 | CLANG_ENABLE_OBJC_ARC = YES; 185 | CLANG_WARN_BOOL_CONVERSION = YES; 186 | CLANG_WARN_CONSTANT_CONVERSION = YES; 187 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 188 | CLANG_WARN_EMPTY_BODY = YES; 189 | CLANG_WARN_ENUM_CONVERSION = YES; 190 | CLANG_WARN_INT_CONVERSION = YES; 191 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 192 | CLANG_WARN_UNREACHABLE_CODE = YES; 193 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 194 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 195 | COPY_PHASE_STRIP = NO; 196 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 197 | ENABLE_STRICT_OBJC_MSGSEND = YES; 198 | ENABLE_TESTABILITY = YES; 199 | GCC_C_LANGUAGE_STANDARD = gnu99; 200 | GCC_DYNAMIC_NO_PIC = NO; 201 | GCC_NO_COMMON_BLOCKS = YES; 202 | GCC_OPTIMIZATION_LEVEL = 0; 203 | GCC_PREPROCESSOR_DEFINITIONS = ( 204 | "DEBUG=1", 205 | "$(inherited)", 206 | ); 207 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 208 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 209 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 210 | GCC_WARN_UNDECLARED_SELECTOR = YES; 211 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 212 | GCC_WARN_UNUSED_FUNCTION = YES; 213 | GCC_WARN_UNUSED_VARIABLE = YES; 214 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 215 | MTL_ENABLE_DEBUG_INFO = YES; 216 | ONLY_ACTIVE_ARCH = YES; 217 | SDKROOT = iphoneos; 218 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 219 | }; 220 | name = Debug; 221 | }; 222 | A531139B1B2995150087452E /* Release */ = { 223 | isa = XCBuildConfiguration; 224 | buildSettings = { 225 | ALWAYS_SEARCH_USER_PATHS = NO; 226 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 227 | CLANG_CXX_LIBRARY = "libc++"; 228 | CLANG_ENABLE_MODULES = YES; 229 | CLANG_ENABLE_OBJC_ARC = YES; 230 | CLANG_WARN_BOOL_CONVERSION = YES; 231 | CLANG_WARN_CONSTANT_CONVERSION = YES; 232 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 233 | CLANG_WARN_EMPTY_BODY = YES; 234 | CLANG_WARN_ENUM_CONVERSION = YES; 235 | CLANG_WARN_INT_CONVERSION = YES; 236 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 237 | CLANG_WARN_UNREACHABLE_CODE = YES; 238 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 239 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 240 | COPY_PHASE_STRIP = NO; 241 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 242 | ENABLE_NS_ASSERTIONS = NO; 243 | ENABLE_STRICT_OBJC_MSGSEND = YES; 244 | GCC_C_LANGUAGE_STANDARD = gnu99; 245 | GCC_NO_COMMON_BLOCKS = YES; 246 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 247 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 248 | GCC_WARN_UNDECLARED_SELECTOR = YES; 249 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 250 | GCC_WARN_UNUSED_FUNCTION = YES; 251 | GCC_WARN_UNUSED_VARIABLE = YES; 252 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 253 | MTL_ENABLE_DEBUG_INFO = NO; 254 | SDKROOT = iphoneos; 255 | VALIDATE_PRODUCT = YES; 256 | }; 257 | name = Release; 258 | }; 259 | A531139D1B2995150087452E /* Debug */ = { 260 | isa = XCBuildConfiguration; 261 | buildSettings = { 262 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 263 | INFOPLIST_FILE = D3Notice/Info.plist; 264 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 265 | PRODUCT_BUNDLE_IDENTIFIER = "com.d3.$(PRODUCT_NAME:rfc1034identifier)"; 266 | PRODUCT_NAME = "$(TARGET_NAME)"; 267 | }; 268 | name = Debug; 269 | }; 270 | A531139E1B2995150087452E /* Release */ = { 271 | isa = XCBuildConfiguration; 272 | buildSettings = { 273 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 274 | INFOPLIST_FILE = D3Notice/Info.plist; 275 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 276 | PRODUCT_BUNDLE_IDENTIFIER = "com.d3.$(PRODUCT_NAME:rfc1034identifier)"; 277 | PRODUCT_NAME = "$(TARGET_NAME)"; 278 | }; 279 | name = Release; 280 | }; 281 | /* End XCBuildConfiguration section */ 282 | 283 | /* Begin XCConfigurationList section */ 284 | A53113781B2995140087452E /* Build configuration list for PBXProject "D3Notice" */ = { 285 | isa = XCConfigurationList; 286 | buildConfigurations = ( 287 | A531139A1B2995150087452E /* Debug */, 288 | A531139B1B2995150087452E /* Release */, 289 | ); 290 | defaultConfigurationIsVisible = 0; 291 | defaultConfigurationName = Release; 292 | }; 293 | A531139C1B2995150087452E /* Build configuration list for PBXNativeTarget "D3Notice" */ = { 294 | isa = XCConfigurationList; 295 | buildConfigurations = ( 296 | A531139D1B2995150087452E /* Debug */, 297 | A531139E1B2995150087452E /* Release */, 298 | ); 299 | defaultConfigurationIsVisible = 0; 300 | defaultConfigurationName = Release; 301 | }; 302 | /* End XCConfigurationList section */ 303 | }; 304 | rootObject = A53113751B2995140087452E /* Project object */; 305 | } 306 | -------------------------------------------------------------------------------- /D3Notice.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /D3Notice.xcodeproj/project.xcworkspace/xcshareddata/D3Notice.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 0DCE1202-B8E8-470C-A027-DBDF93B96D82 9 | IDESourceControlProjectName 10 | D3Notice 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 19358F506DC76AE414130BA928321420D3F662D3 14 | https://github.com/mozhenhau/D3Notice.git 15 | 16 | IDESourceControlProjectPath 17 | D3Notice.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 19358F506DC76AE414130BA928321420D3F662D3 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/mozhenhau/D3Notice.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 19358F506DC76AE414130BA928321420D3F662D3 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 19358F506DC76AE414130BA928321420D3F662D3 36 | IDESourceControlWCCName 37 | D3Notice 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /D3Notice/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // D3Notice 4 | // 5 | // Created by mozhenhau on 15/6/11. 6 | // Copyright (c) 2015年 mozhenhau. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // 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. 24 | // 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. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 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 | func applicationDidBecomeActive(application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /D3Notice/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 | -------------------------------------------------------------------------------- /D3Notice/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 33 | 46 | 59 | 72 | 85 | 98 | 111 | 124 | 137 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | -------------------------------------------------------------------------------- /D3Notice/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 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /D3Notice/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 | 40 | 41 | -------------------------------------------------------------------------------- /D3Notice/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // D3Notice 4 | // 5 | // Created by mozhenhau on 15/6/11. 6 | // Copyright (c) 2015年 mozhenhau. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | 14 | @IBAction func clickClearNotcie(sender: AnyObject) { 15 | clearAll() 16 | timer?.invalidate() 17 | timer = nil 18 | } 19 | 20 | @IBAction func clickShowSuc(sender: AnyObject) { 21 | showNoticeSuc("suc") 22 | } 23 | 24 | 25 | @IBAction func clickShowSucNotDisapear(sender: AnyObject) { 26 | showNoticeSuc("suc", time: D3NoticeManager.longTime, autoClear: false) 27 | } 28 | 29 | @IBAction func clickShowErr(sender: AnyObject) { 30 | showNoticeErr("err") 31 | } 32 | 33 | @IBAction func clickSowInfo(sender: AnyObject) { 34 | showNoticeInfo("info") 35 | } 36 | 37 | @IBAction func clickShowWait(sender: AnyObject) { 38 | showNoticeWait() 39 | } 40 | 41 | @IBAction func clickShowText(sender: AnyObject) { 42 | showNoticeText("text") 43 | } 44 | 45 | @IBAction func clickShowSuc2(sender: AnyObject) { 46 | D3NoticeManager.sharedInstance.showNoticeWithText(NoticeType.Success, text: "suc",time: D3NoticeManager.longTime, autoClear: true) 47 | } 48 | 49 | var progress:Double = 0 50 | var timer:NSTimer? 51 | var type:NoticeType = NoticeType.CircleProgress 52 | @IBAction func clickProgressCircle(sender: AnyObject) { 53 | progress = 0 54 | timer?.invalidate() 55 | type = NoticeType.CircleProgress 56 | timer = NSTimer.scheduledTimerWithTimeInterval(0.1, target: self, selector: Selector("updateProgress:"), userInfo: nil, repeats: true) 57 | } 58 | 59 | 60 | @IBAction func clickProgressLine(sender: AnyObject) { 61 | progress = 0 62 | timer?.invalidate() 63 | type = NoticeType.LineProgress 64 | timer = NSTimer.scheduledTimerWithTimeInterval(0.1, target: self, selector: Selector("updateProgress:"), userInfo: nil, repeats: true) 65 | } 66 | 67 | 68 | func updateProgress(timer:NSTimer){ 69 | progress += 0.01 70 | self.showProgressView(progress, type: type) 71 | } 72 | } 73 | 74 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Ruoyu Fu 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 13 | all 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 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # D3Notice 2 | 3 | ##介绍 4 | 纯代码实现,不需要加图 5 | D3Notice是用swift写的IOS的自定义AlertView。包括纯文字提示,成功、失败、警告、菊花图和进度显示。是扩展UIViewController的实现。 6 | ![此处输入图片的描述][1] 7 | 8 | 9 | [1]: http://7vzpd0.com1.z0.glb.clouddn.com/more.gif 10 | 11 | 12 | ##使用 13 | ###在UIViewController 14 | 对应上图的功能,直接在UIViewController里使用 15 | 16 | clearAllNotice() 17 | 18 | showNoticeSuc("suc") 19 | 20 | showNoticeSuc("suc", time: D3Notice.longTime, autoClear: false) 21 | 22 | showNoticeErr("err") 23 | 24 | showNoticeInfo("info") 25 | 26 | showNoticeWait() 27 | 28 | showNoticeText("text") 29 | 30 | showProgressView(0.5, type: NoticeType.LineProgress) 31 | 32 | ###不在UIViewController 33 | 如果不是在UIViewController,使用方法: 34 | 35 | D3Notice.showNoticeWithText(NoticeType.success, text: "suc",time: D3Notice.longTime, autoClear: true) 36 | 37 | ###Tips 38 | 配合本人github项目里的D3View可容易实现弹窗动画 39 | 地址:https://github.com/mozhenhau/D3View 40 | D3Notice加动画效果已集成至D3View里的D3Notice 41 | 42 | 43 | ##安装使用 44 | ###使用CocoaPods (iOS 8+, OS X 10.9+) 45 | 46 | platform :ios, '8.0' 47 | use_frameworks! 48 | 49 | pod 'D3Notice', '~> 2.0.0' 50 | 51 | swift调用framework需要import D3Notice 52 | 53 | ###普通使用 54 | 只需拖动D3Notice.swift文件 55 | --------------------------------------------------------------------------------