├── README.md ├── YoCelsius.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ ├── YXMWeather.xccheckout │ │ └── YXMWeather.xcscmblueprint │ └── xcuserdata │ │ ├── YouXianMing.xcuserdatad │ │ ├── UserInterfaceState.xcuserstate │ │ └── WorkspaceSettings.xcsettings │ │ ├── YouXianMing1987@iCloud.com.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ │ └── mac.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ ├── YouXianMing.xcuserdatad │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ │ ├── YoCelsius.xcscheme │ │ └── xcschememanagement.plist │ ├── YouXianMing1987@iCloud.com.xcuserdatad │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ │ ├── YoCelsius.xcscheme │ │ └── xcschememanagement.plist │ └── mac.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist └── YoCelsius ├── AFNetworking ├── AFHTTPSessionManager.h ├── AFHTTPSessionManager.m ├── AFNetworkReachabilityManager.h ├── AFNetworkReachabilityManager.m ├── AFNetworking.h ├── AFSecurityPolicy.h ├── AFSecurityPolicy.m ├── AFURLRequestSerialization.h ├── AFURLRequestSerialization.m ├── AFURLResponseSerialization.h ├── AFURLResponseSerialization.m ├── AFURLSessionManager.h └── AFURLSessionManager.m ├── ARCGPathFromString ├── ARCGPathFromString.h ├── ARCGPathFromString.m ├── UIBezierPath+TextPaths.h └── UIBezierPath+TextPaths.m ├── AbsNetworking.h ├── AbsNetworking.m ├── AbsNetworkingIndicator.h ├── AbsNetworkingIndicator.m ├── AbsNetworkingReachability.h ├── AbsNetworkingReachability.m ├── AbsRequestParameterSerializer.h ├── AbsRequestParameterSerializer.m ├── AbsResponseDataSerializer.h ├── AbsResponseDataSerializer.m ├── AddedFont.h ├── AlphaView.h ├── AlphaView.m ├── Amatepec.json ├── AnimatedLineView.h ├── AnimatedLineView.m ├── AppDelegate.h ├── AppDelegate.m ├── Arthur's Pass.json ├── Australia.json ├── CALayer+MaskLayer.h ├── CALayer+MaskLayer.m ├── CGRectStoreValue.h ├── CGRectStoreValue.m ├── ChangeColorLabel.h ├── ChangeColorLabel.m ├── CircleView.h ├── CircleView.m ├── City.h ├── City.m ├── CityTitleView.h ├── CityTitleView.m ├── Clouds.h ├── Clouds.m ├── Color ├── AppColor.h ├── NSString+Color.h └── NSString+Color.m ├── Coord.h ├── Coord.m ├── CurrentConditions.h ├── CurrentConditions.m ├── CurrentWeatherData.h ├── CurrentWeatherData.m ├── DeviceInfo.h ├── DeviceInfo.m ├── DismissingAnimator.h ├── DismissingAnimator.m ├── EmitterLayerView.h ├── EmitterLayerView.m ├── FadeBlackView.h ├── FadeBlackView.m ├── FailedLongPressView.h ├── FailedLongPressView.m ├── File ├── NSString+File.h └── NSString+File.m ├── FontInfomation ├── FontInfomation.h └── FontInfomation.m ├── ForecastCell.h ├── ForecastCell.m ├── ForecastController.h ├── ForecastController.m ├── ForecastWeatherView.h ├── ForecastWeatherView.m ├── FrameView.h ├── FrameView.m ├── Fushan.json ├── Gaoqiao.json ├── GetWeatherData.h ├── GetWeatherData.m ├── GridView.h ├── GridView.m ├── Haidian.json ├── Hinganghāt.json ├── HumidityCount.h ├── HumidityCount.m ├── HumidityCountLabel.h ├── HumidityCountLabel.m ├── HumidityView.h ├── HumidityView.m ├── Images.xcassets ├── AppIcon.appiconset │ ├── 1024x1024.png │ ├── Contents.json │ ├── Icon-60@2x.png │ ├── Icon-60@3x.png │ ├── Icon-72.png │ ├── Icon-72@2x.png │ ├── Icon-76.png │ ├── Icon-76@2x.png │ ├── Icon-Small-50.png │ ├── Icon-Small-50@2x.png │ ├── Icon-Small.png │ ├── Icon-Small@2x.png │ ├── Icon-Small@3x.png │ ├── Icon-Spotlight-40.png │ ├── Icon-Spotlight-40@2x.png │ ├── Icon-Spotlight-40@3x.png │ ├── Icon.png │ └── Icon@2x.png ├── Contents.json ├── Pictures │ ├── WindSpeed.imageset │ │ ├── Contents.json │ │ └── WindSpeed@2x.png │ ├── alpha.imageset │ │ ├── Contents.json │ │ └── alpha@2x.png │ ├── icon-error.imageset │ │ ├── Contents.json │ │ ├── icon-error.png │ │ └── icon-error@2x.png │ ├── icon-info.imageset │ │ ├── Contents.json │ │ ├── icon-info.png │ │ └── icon-info@2x.png │ ├── icon-success.imageset │ │ ├── Contents.json │ │ ├── icon-success.png │ │ └── icon-success@2x.png │ ├── moon.imageset │ │ ├── Contents.json │ │ └── moon@2x.png │ ├── rain.imageset │ │ ├── Contents.json │ │ └── rain@2x.png │ ├── snow.imageset │ │ ├── Contents.json │ │ └── snow@2x.png │ └── sun.imageset │ │ ├── Contents.json │ │ └── sun@2x.png └── cover.imageset │ ├── Contents.json │ └── cover@3x.png ├── Info.plist ├── JSONKit ├── NSArray+JSONData.h ├── NSArray+JSONData.m ├── NSData+JSONData.h ├── NSData+JSONData.m ├── NSDictionary+JSONData.h ├── NSDictionary+JSONData.m ├── NSString+JSONData.h └── NSString+JSONData.m ├── Kohlu.json ├── LabelView.h ├── LabelView.m ├── Lato-Bold.ttf ├── Lato-Light.ttf ├── Lato-Regular.ttf ├── Lato-Thin.ttf ├── Lato-ThinItalic.ttf ├── Launch Screen.storyboard ├── LeftToRightView.h ├── LeftToRightView.m ├── LineAnimationView.h ├── LineAnimationView.m ├── LineBackgroundView.h ├── LineBackgroundView.m ├── LoadingView.h ├── LoadingView.m ├── LongTapAnimationView.h ├── LongTapAnimationView.m ├── MainInfo.h ├── MainInfo.m ├── Map ├── MapManager.h └── MapManager.m ├── Maqiao.json ├── MaxTempCount.h ├── MaxTempCount.m ├── MaxTempCountLabel.h ├── MaxTempCountLabel.m ├── MaxTempView.h ├── MaxTempView.m ├── MinTempContLabel.h ├── MinTempContLabel.m ├── MinTempCount.h ├── MinTempCount.m ├── Networking+YoCelsius.h ├── Networking+YoCelsius.m ├── Networking.h ├── Networking.m ├── NetworkingInfo.h ├── NetworkingInfo.m ├── NewYork.json ├── Northwest.json ├── NumberCount.h ├── NumberCount.m ├── Osterley.json ├── PathDirectionView.h ├── PathDirectionView.m ├── PresentingAnimator.h ├── PresentingAnimator.m ├── PressAnimationButton.h ├── PressAnimationButton.m ├── RainView.h ├── RainView.m ├── RequestBodyType.h ├── RequestBodyType.m ├── RequestMethodType.h ├── RequestMethodType.m ├── RequestParameterSerializer.h ├── RequestParameterSerializer.m ├── ResponseDataManager.h ├── ResponseDataManager.m ├── ResponseDataSerializer.h ├── ResponseDataSerializer.m ├── ResponseDataType.h ├── ResponseDataType.m ├── RichText ├── ConfigAttributedString.h ├── ConfigAttributedString.m ├── NSString+RichText.h └── NSString+RichText.m ├── RotatedAngleView.h ├── RotatedAngleView.m ├── ShapeWordView.h ├── ShapeWordView.m ├── Shijiazhuang.json ├── ShowDownView.h ├── ShowDownView.m ├── SnowView.h ├── SnowView.m ├── StringHeightAndWidth ├── NSString+StringHeight.h └── NSString+StringHeight.m ├── Sun.h ├── Sun.m ├── SunInfoView.h ├── SunInfoView.m ├── SunriseAndSunset.h ├── SunriseAndSunset.m ├── SunriseView.h ├── SunriseView.m ├── SunsetView.h ├── SunsetView.m ├── Sys.h ├── Sys.m ├── TWMessageBarManager.h ├── TWMessageBarManager.m ├── TapTitleView.h ├── TapTitleView.m ├── Temp.h ├── Temp.m ├── TemperatureCount.h ├── TemperatureCount.m ├── TemperatureCountLabel.h ├── TemperatureCountLabel.m ├── TemperatureView.h ├── TemperatureView.m ├── ThreeLineView.h ├── ThreeLineView.m ├── TitleMoveLabel.h ├── TitleMoveLabel.m ├── UIKit+AFNetworking ├── AFAutoPurgingImageCache.h ├── AFAutoPurgingImageCache.m ├── AFImageDownloader.h ├── AFImageDownloader.m ├── AFNetworkActivityIndicatorManager.h ├── AFNetworkActivityIndicatorManager.m ├── UIActivityIndicatorView+AFNetworking.h ├── UIActivityIndicatorView+AFNetworking.m ├── UIButton+AFNetworking.h ├── UIButton+AFNetworking.m ├── UIImage+AFNetworking.h ├── UIImageView+AFNetworking.h ├── UIImageView+AFNetworking.m ├── UIKit+AFNetworking.h ├── UIProgressView+AFNetworking.h ├── UIProgressView+AFNetworking.m ├── UIRefreshControl+AFNetworking.h ├── UIRefreshControl+AFNetworking.m ├── UIWebView+AFNetworking.h └── UIWebView+AFNetworking.m ├── UILabel+Temperature.h ├── UILabel+Temperature.m ├── UIView+DebugFrame.h ├── UIView+DebugFrame.m ├── UIView+GlowView.h ├── UIView+GlowView.m ├── UIView+SetRect.h ├── UIView+SetRect.m ├── UpToDownView.h ├── UpToDownView.m ├── UpdatingView.h ├── UpdatingView.m ├── ViewController.h ├── Wako.json ├── Weather&Time.ttf ├── Weather.h ├── Weather.m ├── WeatherIconView.h ├── WeatherIconView.m ├── WeatherInfo.h ├── WeatherInfo.m ├── WeatherInfoController.h ├── WeatherInfoController.m ├── WeatherNumberMeaningTransform.h ├── WeatherNumberMeaningTransform.m ├── WeatherTitleView.h ├── WeatherTitleView.m ├── WeatherView.h ├── WeatherView.m ├── Wind.h ├── Wind.m ├── WindSpeedCount.h ├── WindSpeedCount.m ├── WindSpeedCountLabel.h ├── WindSpeedCountLabel.m ├── WindSpeedView.h ├── WindSpeedView.m ├── YXEasing ├── Easing.c ├── Easing.h ├── YXEasing.h └── YXEasing.m ├── YXGCD ├── GCD.h ├── GCDGroup.h ├── GCDGroup.m ├── GCDQueue.h ├── GCDQueue.m ├── GCDSemaphore.h ├── GCDSemaphore.m ├── GCDTimer.h └── GCDTimer.m ├── Yerbogachën.json ├── Yicheng.json ├── YoCelsius-bg.png ├── YoCelsius.pch ├── YoCelsiusNetworkingInfo.h ├── YoCelsiusNetworkingInfo.m ├── YoCelsiusRequestParameterSerializer.h ├── YoCelsiusRequestParameterSerializer.m ├── main.m └── pop ├── POP.h ├── POPAction.h ├── POPAnimatableProperty.h ├── POPAnimatableProperty.mm ├── POPAnimatablePropertyTypes.h ├── POPAnimation.h ├── POPAnimation.mm ├── POPAnimationEvent.h ├── POPAnimationEvent.mm ├── POPAnimationEventInternal.h ├── POPAnimationExtras.h ├── POPAnimationExtras.mm ├── POPAnimationInternal.h ├── POPAnimationPrivate.h ├── POPAnimationRuntime.h ├── POPAnimationRuntime.mm ├── POPAnimationTracer.h ├── POPAnimationTracer.mm ├── POPAnimationTracerInternal.h ├── POPAnimator.h ├── POPAnimator.mm ├── POPAnimatorPrivate.h ├── POPBasicAnimation.h ├── POPBasicAnimation.mm ├── POPBasicAnimationInternal.h ├── POPCGUtils.h ├── POPCGUtils.mm ├── POPCustomAnimation.h ├── POPCustomAnimation.mm ├── POPDecayAnimation.h ├── POPDecayAnimation.mm ├── POPDecayAnimationInternal.h ├── POPDefines.h ├── POPGeometry.h ├── POPGeometry.mm ├── POPLayerExtras.h ├── POPLayerExtras.mm ├── POPMath.h ├── POPMath.mm ├── POPPropertyAnimation.h ├── POPPropertyAnimation.mm ├── POPPropertyAnimationInternal.h ├── POPSpringAnimation.h ├── POPSpringAnimation.mm ├── POPSpringAnimationInternal.h ├── POPSpringSolver.h ├── POPVector.h ├── POPVector.mm └── WebCore ├── FloatConversion.h ├── TransformationMatrix.cpp ├── TransformationMatrix.h └── UnitBezier.h /README.md: -------------------------------------------------------------------------------- 1 | # YoCelsius 2 | 3 | > 一款天气预报的应用 4 | 5 | ![one.gif](http://images.cnitblog.com/blog2015/607542/201504/211608037347783.gif) ![two.gif](http://images.cnitblog.com/blog2015/607542/201504/211608153124546.gif) 6 | 7 | 8 | > 帮助 9 | 10 | * [iOS-Design-Patterns](https://github.com/YouXianMing/iOS-Design-Patterns) 是本人写的设计模式实现的合集,感兴趣的朋友可以看看 :]。 11 | * [Animations](https://github.com/YouXianMing/Animations) 与 [Swift-Animations](https://github.com/YouXianMing/Swift-Animations) 是本人另外的一个动画效果合集项目,感兴趣的朋友可以看看 :]。 12 | 13 | 14 | -------------------------------------------------------------------------------- /YoCelsius.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /YoCelsius.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /YoCelsius.xcodeproj/project.xcworkspace/xcshareddata/YXMWeather.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 5D1D632A-9B19-495C-8AB1-E579F0B31BFF 9 | IDESourceControlProjectName 10 | YXMWeather 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | E846FA1C5F9077375A75267DFE4F87EDFC6399C0 14 | https://github.com/YouXianMing/YoCelsius.git 15 | 16 | IDESourceControlProjectPath 17 | YXMWeather.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | E846FA1C5F9077375A75267DFE4F87EDFC6399C0 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/YouXianMing/YoCelsius.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | E846FA1C5F9077375A75267DFE4F87EDFC6399C0 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | E846FA1C5F9077375A75267DFE4F87EDFC6399C0 36 | IDESourceControlWCCName 37 | YoCelsius 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /YoCelsius.xcodeproj/project.xcworkspace/xcshareddata/YXMWeather.xcscmblueprint: -------------------------------------------------------------------------------- 1 | { 2 | "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "E846FA1C5F9077375A75267DFE4F87EDFC6399C0", 3 | "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { 4 | 5 | }, 6 | "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { 7 | "E846FA1C5F9077375A75267DFE4F87EDFC6399C0" : 0, 8 | "5A04178CB2ACB20445C4D4E86111C1F7A89B3322" : 0 9 | }, 10 | "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "5D1D632A-9B19-495C-8AB1-E579F0B31BFF", 11 | "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { 12 | "E846FA1C5F9077375A75267DFE4F87EDFC6399C0" : "YoCelsius", 13 | "5A04178CB2ACB20445C4D4E86111C1F7A89B3322" : "" 14 | }, 15 | "DVTSourceControlWorkspaceBlueprintNameKey" : "YXMWeather", 16 | "DVTSourceControlWorkspaceBlueprintVersion" : 204, 17 | "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "YXMWeather.xcodeproj", 18 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ 19 | { 20 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/YouXianMing\/Swift-GCD.git", 21 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 22 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "5A04178CB2ACB20445C4D4E86111C1F7A89B3322" 23 | }, 24 | { 25 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/YouXianMing\/YoCelsius.git", 26 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 27 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "E846FA1C5F9077375A75267DFE4F87EDFC6399C0" 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /YoCelsius.xcodeproj/project.xcworkspace/xcuserdata/YouXianMing.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius.xcodeproj/project.xcworkspace/xcuserdata/YouXianMing.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /YoCelsius.xcodeproj/project.xcworkspace/xcuserdata/YouXianMing.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges 6 | 7 | SnapshotAutomaticallyBeforeSignificantChanges 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /YoCelsius.xcodeproj/project.xcworkspace/xcuserdata/YouXianMing1987@iCloud.com.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius.xcodeproj/project.xcworkspace/xcuserdata/YouXianMing1987@iCloud.com.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /YoCelsius.xcodeproj/project.xcworkspace/xcuserdata/mac.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius.xcodeproj/project.xcworkspace/xcuserdata/mac.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /YoCelsius.xcodeproj/xcuserdata/YouXianMing.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /YoCelsius.xcodeproj/xcuserdata/YouXianMing.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | YoCelsius.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 10E1F52B1A908C3200AED5D6 16 | 17 | primary 18 | 19 | 20 | 10E1F5441A908C3200AED5D6 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /YoCelsius.xcodeproj/xcuserdata/YouXianMing1987@iCloud.com.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /YoCelsius.xcodeproj/xcuserdata/YouXianMing1987@iCloud.com.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | YoCelsius.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 10E1F52B1A908C3200AED5D6 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /YoCelsius.xcodeproj/xcuserdata/mac.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | YoCelsius.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /YoCelsius/AFNetworking/AFNetworking.h: -------------------------------------------------------------------------------- 1 | // AFNetworking.h 2 | // 3 | // Copyright (c) 2013 AFNetworking (http://afnetworking.com/) 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 | 23 | #import 24 | #import 25 | #import 26 | 27 | #ifndef _AFNETWORKING_ 28 | #define _AFNETWORKING_ 29 | 30 | #import "AFURLRequestSerialization.h" 31 | #import "AFURLResponseSerialization.h" 32 | #import "AFSecurityPolicy.h" 33 | 34 | #if !TARGET_OS_WATCH 35 | #import "AFNetworkReachabilityManager.h" 36 | #endif 37 | 38 | #import "AFURLSessionManager.h" 39 | #import "AFHTTPSessionManager.h" 40 | 41 | #endif /* _AFNETWORKING_ */ 42 | -------------------------------------------------------------------------------- /YoCelsius/AbsNetworkingIndicator.h: -------------------------------------------------------------------------------- 1 | // 2 | // AbsNetworkingIndicator.h 3 | // AFNetworking-3.x 4 | // 5 | // Created by YouXianMing on 16/3/12. 6 | // Copyright © 2016年 YouXianMing. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AbsNetworkingIndicator : NSObject 12 | 13 | /** 14 | * 是否显示网络加载指示器 15 | * 16 | * @param show 是否显示 17 | */ 18 | + (void)showNetworkActivityIndicator:(BOOL)show; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /YoCelsius/AbsNetworkingIndicator.m: -------------------------------------------------------------------------------- 1 | // 2 | // AbsNetworkingIndicator.m 3 | // AFNetworking-3.x 4 | // 5 | // Created by YouXianMing on 16/3/12. 6 | // Copyright © 2016年 YouXianMing. All rights reserved. 7 | // 8 | 9 | #import "AbsNetworkingIndicator.h" 10 | 11 | @implementation AbsNetworkingIndicator 12 | 13 | + (void)showNetworkActivityIndicator:(BOOL)show { 14 | 15 | [NSException raise:@"NetworkingIndicator showNetworkActivityIndicator:" 16 | format:@"You must override this method."]; 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /YoCelsius/AbsNetworkingReachability.h: -------------------------------------------------------------------------------- 1 | // 2 | // AbsNetworkingReachability.h 3 | // AFNetworking-3.x 4 | // 5 | // Created by YouXianMing on 16/3/12. 6 | // Copyright © 2016年 YouXianMing. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | * 外部接收通知用字符串 13 | */ 14 | extern NSString *const NetworkingReachableViaWWANNotification; 15 | extern NSString *const NetworkingReachableViaWIFINotification; 16 | extern NSString *const NetworkingNotReachableNotification; 17 | 18 | @interface AbsNetworkingReachability : NSObject 19 | 20 | /** 21 | * 开始监听网络状态 22 | */ 23 | + (void)startMonitoring; 24 | 25 | /** 26 | * 结束监听网络状态 27 | */ 28 | + (void)stopMonitoring; 29 | 30 | /** 31 | * 是否可以联网 32 | * 33 | * @return YES为可以,NO为不行 34 | */ 35 | + (BOOL)isReachable; 36 | 37 | /** 38 | * 当前是否是WWAN网络 39 | * 40 | * @return YES为是,NO为不是 41 | */ 42 | + (BOOL)isReachableViaWWAN; 43 | 44 | /** 45 | * 当前是否为WIFI网络 46 | * 47 | * @return YES为是,NO为不是 48 | */ 49 | + (BOOL)isReachableViaWiFi; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /YoCelsius/AbsNetworkingReachability.m: -------------------------------------------------------------------------------- 1 | // 2 | // AbsNetworkingReachability.m 3 | // AFNetworking-3.x 4 | // 5 | // Created by YouXianMing on 16/3/12. 6 | // Copyright © 2016年 YouXianMing. All rights reserved. 7 | // 8 | 9 | #import "AbsNetworkingReachability.h" 10 | 11 | NSString *const NetworkingReachableViaWWANNotification = @"NetworkingReachableViaWWAN"; 12 | NSString *const NetworkingReachableViaWIFINotification = @"NetworkingReachableViaWIFI"; 13 | NSString *const NetworkingNotReachableNotification = @"NetworkingNotReachable"; 14 | 15 | @implementation AbsNetworkingReachability 16 | 17 | + (void)startMonitoring { 18 | 19 | [NSException raise:@"NetworkingReachability startMonitoring:" 20 | format:@"You must override this method."]; 21 | } 22 | 23 | + (void)stopMonitoring { 24 | 25 | [NSException raise:@"NetworkingReachability stopMonitoring:" 26 | format:@"You must override this method."]; 27 | } 28 | 29 | + (BOOL)isReachable { 30 | 31 | [NSException raise:@"NetworkingReachability isReachable:" 32 | format:@"You must override this method."]; 33 | 34 | return NO; 35 | } 36 | 37 | + (BOOL)isReachableViaWWAN { 38 | 39 | [NSException raise:@"NetworkingReachability isReachableViaWWAN:" 40 | format:@"You must override this method."]; 41 | 42 | return NO; 43 | } 44 | 45 | + (BOOL)isReachableViaWiFi { 46 | 47 | [NSException raise:@"NetworkingReachability isReachableViaWiFi:" 48 | format:@"You must override this method."]; 49 | 50 | return NO; 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /YoCelsius/AbsRequestParameterSerializer.h: -------------------------------------------------------------------------------- 1 | // 2 | // AbsRequestParameterSerializer.h 3 | // AFNetworking-3.x 4 | // 5 | // Created by YouXianMing on 16/3/15. 6 | // Copyright © 2016年 YouXianMing. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AbsRequestParameterSerializer : NSObject 12 | 13 | /** 14 | * 处理请求参数(字典或者数组) 15 | * 16 | * @param requestParameter 请求参数 17 | * 18 | * @return 处理后的参数 19 | */ 20 | - (id)serializeRequestParameter:(id)requestParameter; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /YoCelsius/AbsRequestParameterSerializer.m: -------------------------------------------------------------------------------- 1 | // 2 | // AbsRequestParameterSerializer.m 3 | // AFNetworking-3.x 4 | // 5 | // Created by YouXianMing on 16/3/15. 6 | // Copyright © 2016年 YouXianMing. All rights reserved. 7 | // 8 | 9 | #import "AbsRequestParameterSerializer.h" 10 | 11 | @implementation AbsRequestParameterSerializer 12 | 13 | - (id)serializeRequestParameter:(id)requestParameter { 14 | 15 | return requestParameter; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /YoCelsius/AbsResponseDataSerializer.h: -------------------------------------------------------------------------------- 1 | // 2 | // AbsResponseDataSerializer.h 3 | // AFNetworking-3.x 4 | // 5 | // Created by YouXianMing on 16/3/12. 6 | // Copyright © 2016年 YouXianMing. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AbsResponseDataSerializer : NSObject 12 | 13 | /** 14 | * 处理返回的参数 15 | * 16 | * @param data 处理前的参数 17 | * 18 | * @return 处理后的参数 19 | */ 20 | - (id)serializeResponseData:(id)data; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /YoCelsius/AbsResponseDataSerializer.m: -------------------------------------------------------------------------------- 1 | // 2 | // AbsResponseDataSerializer.m 3 | // AFNetworking-3.x 4 | // 5 | // Created by YouXianMing on 16/3/12. 6 | // Copyright © 2016年 YouXianMing. All rights reserved. 7 | // 8 | 9 | #import "AbsResponseDataSerializer.h" 10 | 11 | @implementation AbsResponseDataSerializer 12 | 13 | - (id)serializeResponseData:(id)data { 14 | 15 | return data; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /YoCelsius/AddedFont.h: -------------------------------------------------------------------------------- 1 | // 2 | // AddedFont.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/16. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | #import 13 | 14 | #define LATO_REGULAR @"Lato-Regular" 15 | #define LATO_BOLD @"Lato-Bold" 16 | #define LATO_HAIRLINE @"Lato-Hairline" 17 | #define LATO_THIN @"Lato-Thin" 18 | #define LATO_LIGHT @"Lato-Light" 19 | #define LATO_THIN_IT @"Lato-ThinItalic" 20 | 21 | #define WEATHER_TIME @"Weather&Time" 22 | 23 | #define LATO_10 10 24 | #define LATO_14 14 25 | #define LATO_16 16 -------------------------------------------------------------------------------- /YoCelsius/AlphaView.h: -------------------------------------------------------------------------------- 1 | // 2 | // AlphaView.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/20. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | 13 | 14 | @interface AlphaView : UIView 15 | 16 | @property (nonatomic, strong) NSArray *colors; 17 | @property (nonatomic, strong) NSArray *locations; 18 | @property (nonatomic) CGPoint startPoint; 19 | @property (nonatomic) CGPoint endPoint; 20 | 21 | - (void)alphaType; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /YoCelsius/AnimatedLineView.h: -------------------------------------------------------------------------------- 1 | // 2 | // AnimatedLineView.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/18. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | #import "UIView+SetRect.h" 13 | 14 | @interface AnimatedLineView : UIView 15 | 16 | /** 17 | * 显示的图片 18 | */ 19 | @property (nonatomic, strong) UIImage *image; 20 | 21 | /** 22 | * 显示出来 23 | * 24 | * @param duration 动画持续时间 25 | * @param animated 是否执行动画 26 | */ 27 | - (void)showWithDuration:(CGFloat)duration animated:(BOOL)animated; 28 | 29 | /** 30 | * 隐藏 31 | * 32 | * @param duration 动画持续时间 33 | * @param animated 是否执行动画 34 | */ 35 | - (void)hideWithDuration:(CGFloat)duration animated:(BOOL)animated; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /YoCelsius/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/15. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | 13 | @interface AppDelegate : UIResponder 14 | 15 | @property (strong, nonatomic) UIWindow *window; 16 | 17 | @end 18 | 19 | -------------------------------------------------------------------------------- /YoCelsius/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/15. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "AppDelegate.h" 12 | #import "WeatherInfoController.h" 13 | 14 | @interface AppDelegate () 15 | 16 | @end 17 | 18 | @implementation AppDelegate 19 | 20 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 21 | 22 | /* 23 | Lateast no warning version : Version 14.2 (14C18) 24 | */ 25 | 26 | // Init window. 27 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 28 | self.window.backgroundColor = [UIColor whiteColor]; 29 | self.window.rootViewController = [WeatherInfoController new]; 30 | [self.window makeKeyAndVisible]; 31 | 32 | return YES; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /YoCelsius/CALayer+MaskLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // CALayer+MaskLayer.h 3 | // TestCAEmitterLayer 4 | // 5 | // Created by YouXianMing on 14/10/17. 6 | // Copyright (c) 2014年 YouXianMing. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface CALayer (MaskLayer) 13 | 14 | /** 15 | * 根据PNG图片创建出用于mask的layer 16 | * 17 | * @param size mask的尺寸 18 | * @param image 用于mask的图片 19 | * 20 | * @return 创建好的mask的layer 21 | */ 22 | + (CALayer *)createMaskLayerWithSize:(CGSize)size maskPNGImage:(UIImage *)image; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /YoCelsius/CALayer+MaskLayer.m: -------------------------------------------------------------------------------- 1 | // 2 | // CALayer+MaskLayer.m 3 | // TestCAEmitterLayer 4 | // 5 | // Created by YouXianMing on 14/10/17. 6 | // Copyright (c) 2014年 YouXianMing. All rights reserved. 7 | // 8 | 9 | #import "CALayer+MaskLayer.h" 10 | 11 | @implementation CALayer (MaskLayer) 12 | 13 | + (CALayer *)createMaskLayerWithSize:(CGSize)size maskPNGImage:(UIImage *)image { 14 | 15 | CALayer *layer = [CALayer layer]; 16 | layer.anchorPoint = CGPointMake(0, 0); // 重置锚点 17 | layer.bounds = CGRectMake(0, 0, size.width, size.height); // 设置尺寸 18 | 19 | if (image) { 20 | 21 | layer.contents = (__bridge id)(image.CGImage); 22 | } 23 | 24 | return layer; 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /YoCelsius/CGRectStoreValue.h: -------------------------------------------------------------------------------- 1 | // 2 | // CGRectStoreValue.h 3 | // YoCelsius 4 | // 5 | // Created by YouXianMing on 15/12/17. 6 | // Copyright © 2015年 XianMingYou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CGRectStoreValue : NSObject 12 | 13 | @property (nonatomic) CGRect startRect; 14 | @property (nonatomic) CGRect midRect; 15 | @property (nonatomic) CGRect endRect; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /YoCelsius/CGRectStoreValue.m: -------------------------------------------------------------------------------- 1 | // 2 | // CGRectStoreValue.m 3 | // YoCelsius 4 | // 5 | // Created by YouXianMing on 15/12/17. 6 | // Copyright © 2015年 XianMingYou. All rights reserved. 7 | // 8 | 9 | #import "CGRectStoreValue.h" 10 | 11 | @implementation CGRectStoreValue 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YoCelsius/ChangeColorLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // ChangeColorLabel.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/22. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | 13 | @interface ChangeColorLabel : UIView 14 | 15 | @property (nonatomic, strong) UIFont *font; 16 | @property (nonatomic, strong) UIColor *textColor; 17 | @property (nonatomic, strong) UIColor *changedColor; 18 | 19 | /** 20 | * 文本 21 | */ 22 | @property (nonatomic, strong) NSString *text; 23 | 24 | /** 25 | * 设定文本后将会重新更新控件 26 | */ 27 | - (void)updateLabelView; 28 | 29 | /** 30 | * 颜色百分比 31 | * 32 | * @param percent 颜色的百分比 33 | */ 34 | - (void)colorPercent:(CGFloat)percent; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /YoCelsius/CircleView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CircleView.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/17. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | 13 | @interface CircleView : UIView 14 | 15 | /** 16 | * 线条宽度 17 | */ 18 | @property (nonatomic) CGFloat lineWidth; 19 | 20 | /** 21 | * 线条颜色 22 | */ 23 | @property (nonatomic, strong) UIColor *lineColor; 24 | 25 | /** 26 | * 旋转方向 27 | */ 28 | @property (nonatomic) BOOL clockWise; 29 | 30 | /** 31 | * 开始角度 32 | */ 33 | @property (nonatomic) CGFloat startAngle; 34 | 35 | /** 36 | * 初始化view 37 | */ 38 | - (void)buildView; 39 | 40 | /** 41 | * 做stroke动画 42 | * 43 | * @param value 取值 [0, 1] 44 | * @param animated 时候执行动画 45 | */ 46 | - (void)strokeEnd:(CGFloat)value animated:(BOOL)animated duration:(CGFloat)duration; 47 | 48 | - (void)strokeStart:(CGFloat)value animated:(BOOL)animated duration:(CGFloat)duration; 49 | 50 | /** 51 | * 创建出默认配置的view 52 | * 53 | * @param frame 设置用的frame值 54 | * 55 | * @return 实例对象 56 | */ 57 | + (instancetype)createDefaultViewWithFrame:(CGRect)frame; 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /YoCelsius/City.h: -------------------------------------------------------------------------------- 1 | // 2 | // City.h 3 | // 4 | // http://home.cnblogs.com/u/YouXianMing 5 | // https://github.com/YouXianMing 6 | // 7 | // Copyright (c) 2015 YouXianMing All rights reserved. 8 | // 9 | 10 | #import 11 | #import "Coord.h" 12 | 13 | @interface City : NSObject 14 | 15 | @property (nonatomic, strong) Coord *coord; // 经纬度 16 | @property (nonatomic, strong) NSNumber *cityId; // 城市ID 17 | @property (nonatomic, strong) NSString *country; // 国家 18 | @property (nonatomic, strong) NSString *name; // 城市名字 19 | @property (nonatomic, strong) NSNumber *population; 20 | 21 | - (void)setValue:(id)value forUndefinedKey:(NSString *)key; 22 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary; 23 | 24 | @end 25 | 26 | -------------------------------------------------------------------------------- /YoCelsius/City.m: -------------------------------------------------------------------------------- 1 | // 2 | // City.m 3 | // 4 | // http://home.cnblogs.com/u/YouXianMing 5 | // https://github.com/YouXianMing 6 | // 7 | // Copyright (c) 2015 YouXianMing All rights reserved. 8 | // 9 | 10 | #import "City.h" 11 | 12 | @implementation City 13 | 14 | - (void)setValue:(id)value forUndefinedKey:(NSString *)key { 15 | 16 | if([key isEqualToString:@"id"]) { 17 | 18 | self.cityId = value; 19 | } 20 | } 21 | 22 | - (void)setValue:(id)value forKey:(NSString *)key { 23 | 24 | if ([value isKindOfClass:[NSNull class]]) { 25 | 26 | return; 27 | } 28 | 29 | if ([key isEqualToString:@"coord"]) { 30 | 31 | value = [[Coord alloc] initWithDictionary:value]; 32 | } 33 | 34 | [super setValue:value forKey:key]; 35 | } 36 | 37 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary { 38 | 39 | if ([dictionary isKindOfClass:[NSDictionary class]]) { 40 | 41 | self = [super init]; 42 | 43 | if (self) { 44 | 45 | [self setValuesForKeysWithDictionary:dictionary]; 46 | } 47 | 48 | return self; 49 | 50 | } else { 51 | 52 | return nil; 53 | } 54 | } 55 | 56 | @end -------------------------------------------------------------------------------- /YoCelsius/CityTitleView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CityTitleView.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/24. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | #import "SnowView.h" 13 | #import "RainView.h" 14 | #import "WeatherNumberMeaningTransform.h" 15 | 16 | @interface CityTitleView : UIView 17 | 18 | @property (nonatomic, strong) NSString *cityName; 19 | @property (nonatomic, strong) NSString *cityCode; 20 | @property (nonatomic, strong) NSString *weatherDescription; 21 | @property (nonatomic, strong) NSString *baseStation; 22 | @property (nonatomic, strong) NSString *updateYear; 23 | @property (nonatomic, strong) NSString *updateHour; 24 | @property (nonatomic) NSTimeInterval utcSec; 25 | @property (nonatomic, strong) NSNumber *weatherNumber; 26 | 27 | // 创建view 28 | - (void)buildView; 29 | 30 | // 显示view 31 | - (void)show; 32 | 33 | // 隐藏view 34 | - (void)hide; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /YoCelsius/Clouds.h: -------------------------------------------------------------------------------- 1 | // 2 | // Clouds.h 3 | // 4 | // http://home.cnblogs.com/u/YouXianMing 5 | // https://github.com/YouXianMing 6 | // 7 | // Copyright (c) 2015 YouXianMing All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | @interface Clouds : NSObject 13 | 14 | @property (nonatomic, strong) NSNumber *all; // Cloudiness, % 15 | 16 | - (void)setValue:(id)value forUndefinedKey:(NSString *)key; 17 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary; 18 | 19 | @end 20 | 21 | -------------------------------------------------------------------------------- /YoCelsius/Clouds.m: -------------------------------------------------------------------------------- 1 | // 2 | // Clouds.m 3 | // 4 | // http://home.cnblogs.com/u/YouXianMing 5 | // https://github.com/YouXianMing 6 | // 7 | // Copyright (c) 2015 YouXianMing All rights reserved. 8 | // 9 | 10 | #import "Clouds.h" 11 | 12 | @implementation Clouds 13 | 14 | - (void)setValue:(id)value forUndefinedKey:(NSString *)key { 15 | 16 | } 17 | 18 | - (void)setValue:(id)value forKey:(NSString *)key { 19 | 20 | if ([value isKindOfClass:[NSNull class]]) { 21 | 22 | return; 23 | } 24 | 25 | [super setValue:value forKey:key]; 26 | } 27 | 28 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary { 29 | 30 | if ([dictionary isKindOfClass:[NSDictionary class]]) { 31 | 32 | self = [super init]; 33 | 34 | if (self) { 35 | 36 | [self setValuesForKeysWithDictionary:dictionary]; 37 | } 38 | 39 | return self; 40 | 41 | } else { 42 | 43 | return nil; 44 | } 45 | } 46 | 47 | @end -------------------------------------------------------------------------------- /YoCelsius/Color/AppColor.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppColor.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/15. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | #import "NSString+Color.h" 13 | 14 | // 背景色 15 | #define COLOR_BACKGROUND_ [@"191919" colorFromRGBcode] 16 | 17 | // 红色 18 | #define COLOR_RED_ [@"a62424" colorFromRGBcode] 19 | 20 | // 选中的颜色 21 | #define COLOR_SELECTED_ [@"3e3e3e" colorFromRGBcode] 22 | 23 | // 绿色 24 | #define COLOR_GREEN_ [@"198a88" colorFromRGBcode] 25 | 26 | // 灰色字体 27 | #define COLOR_GRAY_FONT_ [@"575757" colorFromRGBcode] 28 | 29 | // 黄色 30 | #define COLOR_YELLOW_ [@"d78716" colorFromRGBcode] 31 | 32 | // 白色 33 | #define COLOR_WHITE_ [@"ffffff" colorFromRGBcode] 34 | 35 | // 圆圈灰色 36 | #define COLOR_CIRCLE_ [@"C2C2C2" colorFromRGBcode] 37 | 38 | // 39 | #define COLOR_PURE_ [@"9000ff" colorFromRGBcode] 40 | 41 | -------------------------------------------------------------------------------- /YoCelsius/Coord.h: -------------------------------------------------------------------------------- 1 | // 2 | // Coord.h 3 | // 4 | // http://home.cnblogs.com/u/YouXianMing 5 | // https://github.com/YouXianMing 6 | // 7 | // Copyright (c) 2015 YouXianMing All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | @interface Coord : NSObject 13 | 14 | @property (nonatomic, strong) NSNumber *lon; 15 | @property (nonatomic, strong) NSNumber *lat; 16 | 17 | - (void)setValue:(id)value forUndefinedKey:(NSString *)key; 18 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary; 19 | 20 | @end 21 | 22 | -------------------------------------------------------------------------------- /YoCelsius/Coord.m: -------------------------------------------------------------------------------- 1 | // 2 | // Coord.m 3 | // 4 | // http://home.cnblogs.com/u/YouXianMing 5 | // https://github.com/YouXianMing 6 | // 7 | // Copyright (c) 2015 YouXianMing All rights reserved. 8 | // 9 | 10 | #import "Coord.h" 11 | 12 | @implementation Coord 13 | 14 | - (void)setValue:(id)value forUndefinedKey:(NSString *)key { 15 | 16 | } 17 | 18 | - (void)setValue:(id)value forKey:(NSString *)key { 19 | 20 | if ([value isKindOfClass:[NSNull class]]) { 21 | 22 | return; 23 | } 24 | 25 | [super setValue:value forKey:key]; 26 | } 27 | 28 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary { 29 | 30 | if ([dictionary isKindOfClass:[NSDictionary class]]) { 31 | 32 | self = [super init]; 33 | 34 | if (self) { 35 | 36 | [self setValuesForKeysWithDictionary:dictionary]; 37 | } 38 | 39 | return self; 40 | 41 | } else { 42 | 43 | return nil; 44 | } 45 | } 46 | 47 | @end -------------------------------------------------------------------------------- /YoCelsius/CurrentConditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // CurrentConditions.h 3 | // 4 | // http://home.cnblogs.com/u/YouXianMing 5 | // https://github.com/YouXianMing 6 | // 7 | // Copyright (c) 2015 YouXianMing All rights reserved. 8 | // 9 | 10 | #import 11 | #import "City.h" 12 | #import "WeatherInfo.h" 13 | 14 | /* 15 | GET请求 16 | @"http://api.openweathermap.org/data/2.5/forecast/daily" 17 | 18 | 参数列表 19 | @{@"lat" : @"39.88293652833437", 20 | @"lon" : @"116.4621119300779"} 21 | */ 22 | 23 | @interface CurrentConditions : NSObject 24 | 25 | @property (nonatomic, strong) City *city; // 城市信息 26 | @property (nonatomic, strong) NSArray *list; // WeatherInfo信息列表 27 | 28 | @property (nonatomic, strong) NSNumber *message; // System parameter, do not use it 29 | @property (nonatomic, strong) NSString *cod; 30 | @property (nonatomic, strong) NSNumber *cnt; // Number of lines returned by this API call 31 | 32 | - (void)setValue:(id)value forUndefinedKey:(NSString *)key; 33 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary; 34 | 35 | @end 36 | 37 | -------------------------------------------------------------------------------- /YoCelsius/CurrentConditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // CurrentConditions.m 3 | // 4 | // http://home.cnblogs.com/u/YouXianMing 5 | // https://github.com/YouXianMing 6 | // 7 | // Copyright (c) 2015 YouXianMing All rights reserved. 8 | // 9 | 10 | #import "CurrentConditions.h" 11 | 12 | @implementation CurrentConditions 13 | 14 | - (void)setValue:(id)value forUndefinedKey:(NSString *)key { 15 | 16 | } 17 | 18 | - (void)setValue:(id)value forKey:(NSString *)key { 19 | 20 | if ([value isKindOfClass:[NSNull class]]) { 21 | 22 | return; 23 | } 24 | 25 | if ([key isEqualToString:@"city"]) { 26 | 27 | value = [[City alloc] initWithDictionary:value]; 28 | } 29 | 30 | if ([key isEqualToString:@"list"] && [value isKindOfClass:[NSArray class]]) { 31 | 32 | NSArray *tmp = value; 33 | NSMutableArray *weatherInfoList = [NSMutableArray array]; 34 | 35 | for (NSDictionary *info in tmp) { 36 | 37 | WeatherInfo *weatherInfo = [[WeatherInfo alloc] initWithDictionary:info]; 38 | [weatherInfoList addObject:weatherInfo]; 39 | } 40 | 41 | value = weatherInfoList; 42 | } 43 | 44 | [super setValue:value forKey:key]; 45 | } 46 | 47 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary { 48 | 49 | if ([dictionary isKindOfClass:[NSDictionary class]]) { 50 | 51 | if (self = [super init]) { 52 | 53 | [self setValuesForKeysWithDictionary:dictionary]; 54 | } 55 | 56 | return self; 57 | 58 | } else { 59 | 60 | return nil; 61 | } 62 | } 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /YoCelsius/CurrentWeatherData.h: -------------------------------------------------------------------------------- 1 | // 2 | // CurrentWeatherData.h 3 | // 4 | // http://home.cnblogs.com/u/YouXianMing 5 | // https://github.com/YouXianMing 6 | // 7 | // Copyright (c) 2015 YouXianMing All rights reserved. 8 | // 9 | 10 | #import 11 | #import "Coord.h" 12 | #import "Sys.h" 13 | #import "MainInfo.h" 14 | #import "Wind.h" 15 | #import "Clouds.h" 16 | #import "Weather.h" 17 | 18 | /* 19 | 20 | GET请求 21 | @"http://api.openweathermap.org/data/2.5/weather" 22 | 23 | @{@"lat" : @"39.88293652833437", 24 | @"lon" : @"116.4621119300779"} 25 | 26 | */ 27 | 28 | @interface CurrentWeatherData : NSObject 29 | 30 | @property (nonatomic, strong) NSNumber *cod; // 状态码 31 | @property (nonatomic, strong) NSNumber *cityId; // 城市ID 32 | @property (nonatomic, strong) NSString *name; // 城市名字 33 | @property (nonatomic, strong) NSString *base; // 检测的站点 34 | @property (nonatomic, strong) Coord *coord; // 经纬度坐标 35 | 36 | @property (nonatomic, strong) NSNumber *dt; // Data receiving time, unix time, GMT 37 | 38 | @property (nonatomic, strong) NSArray *weather; // 天气信息列表 39 | @property (nonatomic, strong) MainInfo *main; // Group of weather parameters (Rain, Snow, Extreme etc.) 40 | @property (nonatomic, strong) Sys *sys; 41 | @property (nonatomic, strong) Wind *wind; 42 | @property (nonatomic, strong) Clouds *clouds; 43 | 44 | - (void)setValue:(id)value forUndefinedKey:(NSString *)key; 45 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary; 46 | 47 | @end 48 | 49 | -------------------------------------------------------------------------------- /YoCelsius/DeviceInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // DeviceInfo.h 3 | // YoCelsius 4 | // 5 | // Created by YouXianMing on 2020/6/20. 6 | // Copyright © 2020 XianMingYou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DeviceInfo : NSObject 12 | 13 | + (BOOL)isFringeScreen; 14 | 15 | + (CGFloat)fringeScreenTopSafeHeight; 16 | 17 | + (CGFloat)fringeScreenBottomSafeHeight; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /YoCelsius/DeviceInfo.m: -------------------------------------------------------------------------------- 1 | // 2 | // DeviceInfo.m 3 | // YoCelsius 4 | // 5 | // Created by YouXianMing on 2020/6/20. 6 | // Copyright © 2020 XianMingYou. All rights reserved. 7 | // 8 | 9 | #import "DeviceInfo.h" 10 | 11 | @implementation DeviceInfo 12 | 13 | + (BOOL)isFringeScreen { 14 | 15 | static BOOL isFringeScreen = NO; 16 | 17 | static dispatch_once_t onceToken; 18 | dispatch_once(&onceToken, ^{ 19 | 20 | if (@available(iOS 11.0, *)) { 21 | 22 | isFringeScreen = [[[UIApplication sharedApplication] windows] firstObject].safeAreaInsets.bottom > 0; 23 | } 24 | }); 25 | 26 | return isFringeScreen; 27 | } 28 | 29 | + (CGFloat)fringeScreenTopSafeHeight { 30 | 31 | static CGFloat height = 0; 32 | 33 | static dispatch_once_t onceToken; 34 | dispatch_once(&onceToken, ^{ 35 | 36 | if (DeviceInfo.isFringeScreen) { 37 | 38 | height = 44.f; 39 | } 40 | }); 41 | 42 | return height; 43 | } 44 | 45 | + (CGFloat)fringeScreenBottomSafeHeight { 46 | 47 | static CGFloat height = 0; 48 | 49 | static dispatch_once_t onceToken; 50 | dispatch_once(&onceToken, ^{ 51 | 52 | if (DeviceInfo.isFringeScreen) { 53 | 54 | height = 34.f; 55 | } 56 | }); 57 | 58 | return height; 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /YoCelsius/DismissingAnimator.h: -------------------------------------------------------------------------------- 1 | // 2 | // DismissingAnimator.h 3 | // MeiBaoShangCheng 4 | // 5 | // Created by wooboo on 14-6-17. 6 | // Copyright (c) 2014年 Y.X. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface DismissingAnimator : NSObject 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /YoCelsius/DismissingAnimator.m: -------------------------------------------------------------------------------- 1 | // 2 | // DismissingAnimator.m 3 | // MeiBaoShangCheng 4 | // 5 | // Created by wooboo on 14-6-17. 6 | // Copyright (c) 2014年 Y.X. All rights reserved. 7 | // 8 | 9 | #import "DismissingAnimator.h" 10 | #import "UIView+SetRect.h" 11 | 12 | @implementation DismissingAnimator 13 | 14 | - (NSTimeInterval)transitionDuration:(id )transitionContext { 15 | 16 | return 0.5f; 17 | } 18 | 19 | - (void)animateTransition:(id )transitionContext { 20 | 21 | // 自己的view 22 | UIView *fromView = [transitionContext viewForKey:UITransitionContextFromViewKey]; 23 | 24 | // 动画时间 25 | CGFloat duration = [self transitionDuration:transitionContext]; 26 | 27 | // 开始点 + 结束点 28 | CGPoint startPoint = fromView.center; 29 | CGPoint endPoint = CGPointMake(fromView.middleX, 30 | fromView.middleY + Height); 31 | 32 | // 关键帧动画 33 | CAKeyframeAnimation *keyAnimation = [CAKeyframeAnimation animation]; 34 | keyAnimation.keyPath = @"position"; 35 | keyAnimation.values = [YXEasing calculateFrameFromPoint:startPoint toPoint:endPoint 36 | func:CubicEaseIn frameCount:duration * 60.f]; 37 | keyAnimation.duration = duration; 38 | fromView.center = endPoint; 39 | [fromView.layer addAnimation:keyAnimation forKey:nil]; 40 | 41 | [GCDQueue executeInMainQueue:^{ 42 | 43 | [transitionContext completeTransition:YES]; 44 | 45 | } afterDelaySecs:duration]; 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /YoCelsius/EmitterLayerView.m: -------------------------------------------------------------------------------- 1 | // 2 | // EmitterLayerView.m 3 | // TestCAEmitterLayer 4 | // 5 | // Created by YouXianMing on 14/10/17. 6 | // Copyright (c) 2014年 YouXianMing. All rights reserved. 7 | // 8 | 9 | #import "EmitterLayerView.h" 10 | 11 | @interface EmitterLayerView () { 12 | 13 | CAEmitterLayer *_layer; 14 | } 15 | 16 | @end 17 | 18 | @implementation EmitterLayerView 19 | 20 | /** 21 | * 替换layer 22 | * 23 | * @return 替换当前view的layer 24 | */ 25 | + (Class)layerClass { 26 | 27 | return [CAEmitterLayer class]; 28 | } 29 | 30 | /** 31 | * 模拟setter,getter方法 32 | * 33 | */ 34 | - (void)setEmitterLayer:(CAEmitterLayer *)layer { 35 | 36 | _layer = layer; 37 | } 38 | 39 | - (CAEmitterLayer *)emitterLayer { 40 | 41 | return _layer; 42 | } 43 | 44 | - (instancetype)initWithFrame:(CGRect)frame { 45 | 46 | self = [super initWithFrame:frame]; 47 | 48 | if (self) { 49 | 50 | _layer = (CAEmitterLayer *)self.layer; 51 | } 52 | return self; 53 | } 54 | 55 | - (void)show { 56 | 57 | } 58 | 59 | - (void)hide { 60 | 61 | } 62 | 63 | - (void)configType:(EMitterType)type { 64 | 65 | } 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /YoCelsius/FadeBlackView.h: -------------------------------------------------------------------------------- 1 | // 2 | // FadeBlackView.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/28. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | 13 | @interface FadeBlackView : UIView 14 | 15 | - (void)show; 16 | - (void)hide; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /YoCelsius/FadeBlackView.m: -------------------------------------------------------------------------------- 1 | // 2 | // FadeBlackView.m 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/28. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "FadeBlackView.h" 12 | 13 | @implementation FadeBlackView 14 | 15 | - (instancetype)initWithFrame:(CGRect)frame { 16 | 17 | self = [super initWithFrame:CGRectMake(0, 0, Width, Height)]; 18 | if (self) { 19 | 20 | self.backgroundColor = [UIColor blackColor]; 21 | self.alpha = 0.f; 22 | } 23 | 24 | return self; 25 | } 26 | 27 | - (void)show { 28 | 29 | [UIView animateWithDuration:1.f animations:^{ 30 | 31 | self.alpha = 0.75f; 32 | }]; 33 | } 34 | 35 | - (void)hide { 36 | 37 | [UIView animateWithDuration:0.75f animations:^{ 38 | 39 | self.alpha = 0.f; 40 | }]; 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /YoCelsius/FailedLongPressView.h: -------------------------------------------------------------------------------- 1 | // 2 | // FailedLongPressView.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/3/10. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | #import "LineBackgroundView.h" 13 | #import "PressAnimationButton.h" 14 | 15 | @class FailedLongPressView; 16 | 17 | @protocol FailedLongPressViewDelegate 18 | 19 | - (void)pressEvent:(FailedLongPressView *)view; 20 | 21 | @end 22 | 23 | @interface FailedLongPressView : UIView 24 | 25 | @property (nonatomic, weak) id delegate; 26 | 27 | - (void)buildView; 28 | 29 | /** 30 | * 显示 31 | */ 32 | - (void)show; 33 | 34 | /** 35 | * 隐藏 36 | */ 37 | - (void)hide; 38 | 39 | /** 40 | * 移除 41 | */ 42 | - (void)remove; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /YoCelsius/File/NSString+File.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+File.h 3 | // Category 4 | // 5 | // Created by YouXianMing on 14-8-29. 6 | // Copyright (c) 2014年 YouXianMing. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | /* 13 | * path都为相对路径 14 | */ 15 | 16 | @interface NSString (File) 17 | 18 | /** 19 | * 拼接沙盒路径 20 | * 21 | * -------------------- 22 | * /Documents 23 | * /Library/Caches 24 | * /Library/Preferences 25 | * /tmp 26 | * -------------------- 27 | * 28 | * @return 拼接好的路径 29 | */ 30 | - (NSString *)path; 31 | 32 | /** 33 | * bundle文件 34 | * 35 | * @return bundle文件路径 36 | */ 37 | - (NSString *)bundleFile; 38 | 39 | /** 40 | * bundle图片 41 | * 42 | * @return 图片文件 43 | */ 44 | - (UIImage *)bundleImage; 45 | 46 | /** 47 | * 检测文件时候存在 48 | * 49 | * @return 时候存在 50 | */ 51 | - (BOOL)exist; 52 | 53 | /** 54 | * 创建文件夹 55 | * 56 | * @return 创建文件夹 57 | */ 58 | - (BOOL)createFolder; 59 | 60 | /** 61 | * 是否是文件夹 62 | * 63 | * @return 是否是文件夹 64 | */ 65 | - (BOOL)isDirectory; 66 | 67 | /** 68 | * 复制到这个路径 69 | * 70 | * @param path 相对路径 71 | * 72 | * @return 是否成功 73 | */ 74 | - (BOOL)copyTo:(NSString *)path; 75 | 76 | /** 77 | * 移动到这个路径 78 | * 79 | * @param path 路径 80 | * 81 | * @return 是否成功 82 | */ 83 | - (BOOL)moveTo:(NSString *)path; 84 | 85 | /** 86 | * 删除文件 87 | * 88 | * @return 是否成功 89 | */ 90 | - (BOOL)remove; 91 | 92 | /** 93 | * 遍历出文件夹中的文件 94 | * 95 | * @return 文件夹的内容 96 | */ 97 | - (NSArray *)enumeratorFolder; 98 | 99 | /** 100 | * 遍历出文件夹并在block中查看 101 | * 102 | * @param block 数组中遍历出路径 103 | */ 104 | - (void)enumeratorFolderEach:(void (^)(NSString *path))block; 105 | 106 | /** 107 | * 文件信息 108 | * 109 | * @return 文件描述的字典信息 110 | */ 111 | - (NSDictionary *)fileInfo; 112 | 113 | /** 114 | * 文件大小 115 | * 116 | * @return 文件大小 117 | */ 118 | - (int)fileSize; 119 | 120 | @end 121 | -------------------------------------------------------------------------------- /YoCelsius/FontInfomation/FontInfomation.h: -------------------------------------------------------------------------------- 1 | // 2 | // FontInfomation.h 3 | // YouXianMing 4 | // 5 | // Created by XianMingYou on 15/2/11. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | #import 13 | 14 | @interface FontInfomation : NSObject 15 | 16 | /** 17 | * 系统字体信息 18 | * 19 | * @return 系统字体的字典信息 20 | */ 21 | + (NSDictionary *)systomFontNameList; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /YoCelsius/FontInfomation/FontInfomation.m: -------------------------------------------------------------------------------- 1 | // 2 | // FontInfomation.m 3 | // YouXianMing 4 | // 5 | // Created by XianMingYou on 15/2/11. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "FontInfomation.h" 12 | 13 | static NSMutableDictionary *_systemFontDictionary = nil; // 系统字体信息 14 | 15 | @implementation FontInfomation 16 | 17 | + (void)initialize { 18 | 19 | if (self == [FontInfomation class]) { 20 | 21 | _systemFontDictionary = [[NSMutableDictionary alloc] init]; 22 | 23 | // 获取系统字体族 24 | [FontInfomation getSystemFontList]; 25 | } 26 | } 27 | 28 | + (void)getSystemFontList { 29 | 30 | NSArray *familyNames = [UIFont familyNames]; 31 | 32 | for( NSString *familyName in familyNames) { 33 | 34 | NSArray *fontNames = [UIFont fontNamesForFamilyName:familyName]; 35 | [_systemFontDictionary setObject:fontNames forKey:familyName]; 36 | } 37 | } 38 | 39 | + (NSDictionary *)systomFontNameList { 40 | 41 | return [NSDictionary dictionaryWithDictionary:_systemFontDictionary]; 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /YoCelsius/ForecastCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // ForecastCell.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/26. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | 13 | @interface ForecastCell : UITableViewCell 14 | 15 | /** 16 | * 处理常规数据 17 | * 18 | * @param data 处理的数据 19 | */ 20 | - (void)acccessData:(id)data indexPath:(NSIndexPath *)indexPath; 21 | 22 | /** 23 | * 显示 24 | */ 25 | - (void)show; 26 | 27 | /** 28 | * 隐藏 29 | */ 30 | - (void)hide; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /YoCelsius/ForecastController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ForecastController.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/26. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | #import "CurrentConditions.h" 13 | 14 | @interface ForecastController : UIViewController 15 | 16 | @property (nonatomic, strong) CurrentConditions *weatherCondition; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /YoCelsius/ForecastWeatherView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ForecastWeatherView.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/3/4. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | #import "LineBackgroundView.h" 13 | 14 | @interface ForecastWeatherView : UIView 15 | 16 | @property (nonatomic, strong) NSString *countryCode; 17 | @property (nonatomic, strong) NSString *cityName; 18 | - (void)buildView; 19 | - (void)show; 20 | - (void)hide; 21 | 22 | @property (nonatomic, class, readonly) CGFloat viewHeight; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /YoCelsius/FrameView.h: -------------------------------------------------------------------------------- 1 | // 2 | // FrameView.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/16. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | #import "NSString+StringHeight.h" 13 | 14 | @interface FrameView : UIView 15 | 16 | @property (nonatomic, strong) NSString *text; 17 | @property (nonatomic, strong) UIFont *font; 18 | @property (nonatomic, strong) UIColor *textColor; 19 | 20 | @property (nonatomic) CGFloat underLineWidth; 21 | @property (nonatomic, strong) UIColor *underLineColor; 22 | 23 | - (void)buildViews; 24 | 25 | - (void)fadeToShow; 26 | - (void)fadeTohide; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /YoCelsius/GetWeatherData.h: -------------------------------------------------------------------------------- 1 | // 2 | // GetWeatherData.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/25. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | #import 13 | 14 | @protocol GetWeatherDataDelegate 15 | 16 | - (void)weatherData:(id)object sucess:(BOOL)sucess; 17 | 18 | @end 19 | 20 | @interface GetWeatherData : NSObject 21 | 22 | @property (nonatomic, weak) id delegate; 23 | 24 | @property (nonatomic, strong) CLLocation *location; 25 | @property (nonatomic, strong) NSString *cityId; 26 | 27 | - (void)startGetLocalRandomData; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /YoCelsius/GridView.h: -------------------------------------------------------------------------------- 1 | // 2 | // GridView.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/20. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | 13 | @interface GridView : UIView 14 | 15 | /** 16 | * 坐标点 17 | */ 18 | @property (nonatomic) CGPoint origin; 19 | 20 | /** 21 | * 小格的宽度 22 | */ 23 | @property (nonatomic) CGFloat gridLength; 24 | 25 | /** 26 | * 创建出view 27 | */ 28 | - (void)buildView; 29 | 30 | /** 31 | * 显示时长 32 | * 33 | * @param duration 时间长度 34 | */ 35 | - (void)showWithDuration:(CGFloat)duration; 36 | 37 | /** 38 | * 隐藏时长 39 | * 40 | * @param duration 时间长度 41 | */ 42 | - (void)hideWithDuration:(CGFloat)duration; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /YoCelsius/HumidityCount.h: -------------------------------------------------------------------------------- 1 | // 2 | // HumidityCount.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/18. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "NumberCount.h" 12 | 13 | @interface HumidityCount : NumberCount 14 | 15 | - (void)startAnimation; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /YoCelsius/HumidityCountLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // HumidityCountLabel.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/18. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | #import "HumidityCount.h" 13 | 14 | @interface HumidityCountLabel : UIView 15 | 16 | /** 17 | * 起始值 18 | */ 19 | @property (nonatomic) CGFloat fromValue; 20 | 21 | /** 22 | * 结束值 23 | */ 24 | @property (nonatomic) CGFloat toValue; 25 | 26 | /** 27 | * 动画引擎 28 | */ 29 | @property (nonatomic, strong) HumidityCount *humidityCount; 30 | 31 | /** 32 | * 显示用的label 33 | */ 34 | @property (nonatomic, strong) UILabel *countLabel; 35 | 36 | /** 37 | * 显示动画 38 | * 39 | * @param duration 动画时间 40 | */ 41 | - (void)showDuration:(CGFloat)duration; 42 | 43 | /** 44 | * 隐藏动画 45 | * 46 | * @param duration 隐藏时间 47 | */ 48 | - (void)hideDuration:(CGFloat)duration; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /YoCelsius/HumidityCountLabel.m: -------------------------------------------------------------------------------- 1 | // 2 | // HumidityCountLabel.m 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/18. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "HumidityCountLabel.h" 12 | 13 | @interface HumidityCountLabel () 14 | 15 | @end 16 | 17 | @implementation HumidityCountLabel 18 | 19 | - (instancetype)initWithFrame:(CGRect)frame { 20 | 21 | self = [super initWithFrame:frame]; 22 | 23 | if (self) { 24 | 25 | self.countLabel = [[UILabel alloc] initWithFrame:self.bounds]; 26 | self.countLabel.textAlignment = NSTextAlignmentCenter; 27 | [self addSubview:self.countLabel]; 28 | self.countLabel.alpha = 0; 29 | 30 | self.humidityCount = [HumidityCount new]; 31 | self.humidityCount.delegate = self; 32 | } 33 | 34 | return self; 35 | } 36 | 37 | - (void)numberCount:(NumberCount *)numberCount currentSting:(NSAttributedString *)string { 38 | 39 | self.countLabel.attributedText = string; 40 | } 41 | 42 | - (void)showDuration:(CGFloat)duration { 43 | 44 | self.humidityCount.fromValue = self.fromValue; 45 | self.humidityCount.toValue = self.toValue; 46 | self.humidityCount.duration = duration; 47 | self.countLabel.transform = CGAffineTransformMake(1.5, 0, 0, 1.5, 0, 0); 48 | 49 | [self.humidityCount startAnimation]; 50 | 51 | [UIView animateWithDuration:duration animations:^{ 52 | 53 | self.countLabel.transform = CGAffineTransformMake(1, 0, 0, 1, 0, 0); 54 | self.countLabel.alpha = 1.f; 55 | }]; 56 | } 57 | 58 | - (void)hideDuration:(CGFloat)duration { 59 | 60 | self.humidityCount.fromValue = self.toValue; 61 | self.humidityCount.toValue = 0; 62 | self.humidityCount.duration = duration; 63 | 64 | [self.humidityCount startAnimation]; 65 | 66 | [UIView animateWithDuration:duration animations:^{ 67 | 68 | self.countLabel.transform = CGAffineTransformMake(0.5, 0, 0, 0.5, 0, 0); 69 | self.countLabel.alpha = 0.f; 70 | }]; 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /YoCelsius/HumidityView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HumidityView.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/18. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | 13 | @interface HumidityView : UIView 14 | 15 | /** 16 | * 百分比 17 | */ 18 | @property (nonatomic) CGFloat percent; 19 | 20 | - (void)buildView; 21 | - (void)show; 22 | - (void)hide; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/AppIcon.appiconset/1024x1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/AppIcon.appiconset/1024x1024.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-72.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-72@2x.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-76.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-Small-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-Small-50.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-Small-50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-Small-50@2x.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-Small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-Small.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-Small@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-Small@3x.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-40.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-40@2x.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-40@3x.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/AppIcon.appiconset/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/AppIcon.appiconset/Icon.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/AppIcon.appiconset/Icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/AppIcon.appiconset/Icon@2x.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/Pictures/WindSpeed.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "WindSpeed@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/Pictures/WindSpeed.imageset/WindSpeed@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/Pictures/WindSpeed.imageset/WindSpeed@2x.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/Pictures/alpha.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "alpha@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/Pictures/alpha.imageset/alpha@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/Pictures/alpha.imageset/alpha@2x.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/Pictures/icon-error.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "icon-error.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "icon-error@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/Pictures/icon-error.imageset/icon-error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/Pictures/icon-error.imageset/icon-error.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/Pictures/icon-error.imageset/icon-error@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/Pictures/icon-error.imageset/icon-error@2x.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/Pictures/icon-info.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "icon-info.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "icon-info@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/Pictures/icon-info.imageset/icon-info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/Pictures/icon-info.imageset/icon-info.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/Pictures/icon-info.imageset/icon-info@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/Pictures/icon-info.imageset/icon-info@2x.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/Pictures/icon-success.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "icon-success.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "icon-success@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/Pictures/icon-success.imageset/icon-success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/Pictures/icon-success.imageset/icon-success.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/Pictures/icon-success.imageset/icon-success@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/Pictures/icon-success.imageset/icon-success@2x.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/Pictures/moon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "moon@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/Pictures/moon.imageset/moon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/Pictures/moon.imageset/moon@2x.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/Pictures/rain.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "rain@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/Pictures/rain.imageset/rain@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/Pictures/rain.imageset/rain@2x.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/Pictures/snow.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "snow@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/Pictures/snow.imageset/snow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/Pictures/snow.imageset/snow@2x.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/Pictures/sun.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "sun@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/Pictures/sun.imageset/sun@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/Pictures/sun.imageset/sun@2x.png -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/cover.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "scale" : "3x", 14 | "filename" : "cover@3x.png" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YoCelsius/Images.xcassets/cover.imageset/cover@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Images.xcassets/cover.imageset/cover@3x.png -------------------------------------------------------------------------------- /YoCelsius/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 | YoCelsius 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(MARKETING_VERSION) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | LSRequiresIPhoneOS 24 | 25 | NSAppTransportSecurity 26 | 27 | NSAllowsArbitraryLoads 28 | 29 | 30 | NSLocationWhenInUseUsageDescription 31 | 32 | UIAppFonts 33 | 34 | Lato-Regular.ttf 35 | Lato-Bold.ttf 36 | Lato-Thin.ttf 37 | Lato-Light.ttf 38 | Lato-ThinItalic.ttf 39 | Weather&Time.ttf 40 | 41 | UILaunchStoryboardName 42 | Launch Screen 43 | UIRequiredDeviceCapabilities 44 | 45 | armv7 46 | 47 | UIStatusBarHidden 48 | 49 | UISupportedInterfaceOrientations 50 | 51 | UIInterfaceOrientationPortrait 52 | 53 | UIViewControllerBasedStatusBarAppearance 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /YoCelsius/JSONKit/NSArray+JSONData.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+JSONData.h 3 | // AFNetworking 4 | // 5 | // Created by YouXianMing on 15/5/20. 6 | // Copyright (c) 2015年 YouXianMing. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSArray (JSONData) 12 | 13 | /** 14 | * 转换成JSON串字符串(没有可读性) 15 | * 16 | * @return JSON字符串 17 | */ 18 | - (NSString *)toJSONString; 19 | 20 | /** 21 | * 转换成JSON串字符串(有可读性) 22 | * 23 | * @return JSON字符串 24 | */ 25 | - (NSString *)toReadableJSONString; 26 | 27 | /** 28 | * 转换成JSON数据 29 | * 30 | * @return JSON数据 31 | */ 32 | - (NSData *)toJSONData; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /YoCelsius/JSONKit/NSArray+JSONData.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+JSONData.m 3 | // AFNetworking 4 | // 5 | // Created by YouXianMing on 15/5/20. 6 | // Copyright (c) 2015年 YouXianMing. All rights reserved. 7 | // 8 | 9 | #import "NSArray+JSONData.h" 10 | 11 | @implementation NSArray (JSONData) 12 | 13 | - (NSString *)toJSONString { 14 | 15 | NSData *data = [NSJSONSerialization dataWithJSONObject:self 16 | options:NSJSONReadingMutableLeaves | NSJSONReadingAllowFragments 17 | error:nil]; 18 | 19 | if (data == nil) { 20 | 21 | return nil; 22 | } 23 | 24 | NSString *string = [[NSString alloc] initWithData:data 25 | encoding:NSUTF8StringEncoding]; 26 | return string; 27 | } 28 | 29 | - (NSString *)toReadableJSONString { 30 | 31 | NSData *data = [NSJSONSerialization dataWithJSONObject:self 32 | options:NSJSONWritingPrettyPrinted 33 | error:nil]; 34 | 35 | if (data == nil) { 36 | 37 | return nil; 38 | } 39 | 40 | NSString *string = [[NSString alloc] initWithData:data 41 | encoding:NSUTF8StringEncoding]; 42 | return string; 43 | } 44 | 45 | - (NSData *)toJSONData { 46 | 47 | NSData *data = [NSJSONSerialization dataWithJSONObject:self 48 | options:NSJSONWritingPrettyPrinted 49 | error:nil]; 50 | 51 | return data; 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /YoCelsius/JSONKit/NSData+JSONData.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSData+JSONData.h 3 | // Networking 4 | // 5 | // Created by YouXianMing on 15/8/4. 6 | // Copyright (c) 2015年 YouXianMing. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSData (JSONData) 12 | 13 | /** 14 | * 将JSON字符串转换为列表格式(字典或者数组) 15 | * 16 | * @return 字典或者数组 17 | */ 18 | - (id)toListProperty; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /YoCelsius/JSONKit/NSData+JSONData.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSData+JSONData.m 3 | // Networking 4 | // 5 | // Created by YouXianMing on 15/8/4. 6 | // Copyright (c) 2015年 YouXianMing. All rights reserved. 7 | // 8 | 9 | #import "NSData+JSONData.h" 10 | 11 | @implementation NSData (JSONData) 12 | 13 | - (id)toListProperty { 14 | 15 | if (self) { 16 | 17 | return [NSJSONSerialization JSONObjectWithData:self 18 | options:NSJSONReadingMutableLeaves | NSJSONReadingAllowFragments 19 | error:nil]; 20 | } else { 21 | 22 | return nil; 23 | } 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /YoCelsius/JSONKit/NSDictionary+JSONData.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+JSONData.h 3 | // AFNetworking 4 | // 5 | // Created by YouXianMing on 15/5/20. 6 | // Copyright (c) 2015年 YouXianMing. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSDictionary (JSONData) 12 | 13 | /** 14 | * 转换成JSON串字符串(没有可读性) 15 | * 16 | * @return JSON字符串 17 | */ 18 | - (NSString *)toJSONString; 19 | 20 | /** 21 | * 转换成JSON串字符串并去掉/(没有可读性) 22 | * 23 | * @return JSON字符串 24 | */ 25 | - (NSString *)toJSONStringAndReplaceSlash; 26 | 27 | /** 28 | * 转换成JSON串字符串(有可读性) 29 | * 30 | * @return JSON字符串 31 | */ 32 | - (NSString *)toReadableJSONString; 33 | 34 | /** 35 | * 转换成JSON串字符串并去掉/(有可读性) 36 | * 37 | * @return JSON字符串 38 | */ 39 | - (NSString *)toReadableJSONStringAndReplaceSlash; 40 | 41 | /** 42 | * 转换成JSON数据 43 | * 44 | * @return JSON数据 45 | */ 46 | - (NSData *)toJSONData; 47 | 48 | /* 49 | 将 json 字符串转换为字典 50 | */ 51 | + (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString; 52 | @end 53 | -------------------------------------------------------------------------------- /YoCelsius/JSONKit/NSString+JSONData.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+JSONData.h 3 | // Networking 4 | // 5 | // Created by YouXianMing on 15/5/21. 6 | // Copyright (c) 2015年 YouXianMing. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSString (JSONData) 12 | 13 | /** 14 | * 将JSON字符串转换为列表格式(字典或者数组) 15 | * 16 | * @return 字典或者数组 17 | */ 18 | - (id)toListProperty; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /YoCelsius/JSONKit/NSString+JSONData.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+JSONData.m 3 | // Networking 4 | // 5 | // Created by YouXianMing on 15/5/21. 6 | // Copyright (c) 2015年 YouXianMing. All rights reserved. 7 | // 8 | 9 | #import "NSString+JSONData.h" 10 | 11 | @implementation NSString (JSONData) 12 | 13 | - (id)toListProperty { 14 | 15 | if (self) { 16 | 17 | NSData *jsonData = [self dataUsingEncoding:NSUTF8StringEncoding]; 18 | return [NSJSONSerialization JSONObjectWithData:jsonData 19 | options:NSJSONReadingMutableLeaves | NSJSONReadingAllowFragments 20 | error:nil]; 21 | 22 | } else { 23 | 24 | return nil; 25 | } 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /YoCelsius/LabelView.h: -------------------------------------------------------------------------------- 1 | // 2 | // LabelView.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/16. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | #import "NSString+StringHeight.h" 13 | 14 | @interface LabelView : UIView 15 | 16 | /** 17 | * 文本 18 | */ 19 | @property (nonatomic, strong) NSString *text; 20 | 21 | /** 22 | * 文本颜色 23 | */ 24 | @property (nonatomic, strong) UIColor *textColor; 25 | 26 | /** 27 | * 文本字体 28 | */ 29 | @property (nonatomic, strong) UIFont *font; 30 | 31 | /** 32 | * 背景色 33 | */ 34 | @property (nonatomic, strong) UIColor *color; 35 | 36 | /** 37 | * 距离顶部的距离 38 | */ 39 | @property (nonatomic) CGFloat gapFromTop; 40 | 41 | /** 42 | * 距离底部的距离 43 | */ 44 | @property (nonatomic) CGFloat gapFromBottom; 45 | 46 | /** 47 | * 距离左侧的距离 48 | */ 49 | @property (nonatomic) CGFloat gapFromLeft; 50 | 51 | /** 52 | * 距离右侧的距离 53 | */ 54 | @property (nonatomic) CGFloat gapFromRight; 55 | 56 | /** 57 | * 创建出view 58 | */ 59 | - (void)buildView; 60 | 61 | /** 62 | * 创建出默认配置的label 63 | * 64 | * @param text 字符串 65 | * @param origin 起始位置 66 | * 67 | * @return 实例对象 68 | */ 69 | + (instancetype)createWithText:(NSString *)text atOrigin:(CGPoint)origin; 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /YoCelsius/Lato-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Lato-Bold.ttf -------------------------------------------------------------------------------- /YoCelsius/Lato-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Lato-Light.ttf -------------------------------------------------------------------------------- /YoCelsius/Lato-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Lato-Regular.ttf -------------------------------------------------------------------------------- /YoCelsius/Lato-Thin.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Lato-Thin.ttf -------------------------------------------------------------------------------- /YoCelsius/Lato-ThinItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Lato-ThinItalic.ttf -------------------------------------------------------------------------------- /YoCelsius/LeftToRightView.h: -------------------------------------------------------------------------------- 1 | // 2 | // LeftToRightView.h 3 | // AnimatedLineView 4 | // 5 | // Created by XianMingYou on 15/3/4. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "LineAnimationView.h" 12 | 13 | @interface LeftToRightView : LineAnimationView 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /YoCelsius/LeftToRightView.m: -------------------------------------------------------------------------------- 1 | // 2 | // LeftToRightView.m 3 | // AnimatedLineView 4 | // 5 | // Created by XianMingYou on 15/3/4. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "LeftToRightView.h" 12 | 13 | @implementation LeftToRightView 14 | 15 | - (instancetype)initWithFrame:(CGRect)frame { 16 | 17 | self = [super initWithFrame:frame]; 18 | 19 | if (self) { 20 | 21 | CGFloat x = frame.origin.x; 22 | CGFloat y = frame.origin.y; 23 | CGFloat height = frame.size.height; 24 | CGFloat width = frame.size.width; 25 | 26 | self.startFrame = CGRectMake(x, y, 0, height); 27 | self.midFrame = CGRectMake(x, y, width, height); 28 | self.endFrame = CGRectMake(x + width, y, 0, height); 29 | 30 | self.frame = self.startFrame; 31 | } 32 | 33 | return self; 34 | } 35 | 36 | - (void)show { 37 | 38 | // 动画 39 | [UIView animateWithDuration:self.fadeToShowDuration animations:^{ 40 | 41 | self.alpha = self.maxAlpha; 42 | self.frame = self.midFrame; 43 | }]; 44 | } 45 | 46 | - (void)hide { 47 | 48 | // 动画 49 | [UIView animateWithDuration:self.fadeToHideDuration animations:^{ 50 | 51 | self.alpha = 0.f; 52 | self.frame = self.endFrame; 53 | 54 | } completion:^(BOOL finished) { 55 | 56 | self.frame = self.startFrame; 57 | self.alpha = 0.f; 58 | }]; 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /YoCelsius/LineAnimationView.h: -------------------------------------------------------------------------------- 1 | // 2 | // LineAnimationView.h 3 | // AnimatedLineView 4 | // 5 | // Created by XianMingYou on 15/3/4. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | 13 | @interface LineAnimationView : UIView 14 | 15 | @property (nonatomic) CGFloat maxAlpha; 16 | @property (nonatomic) CGFloat fadeToShowDuration; 17 | @property (nonatomic) CGFloat fadeToHideDuration; 18 | 19 | @property (nonatomic) CGRect startFrame; 20 | @property (nonatomic) CGRect midFrame; 21 | @property (nonatomic) CGRect endFrame; 22 | 23 | - (void)show; 24 | - (void)hide; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /YoCelsius/LineAnimationView.m: -------------------------------------------------------------------------------- 1 | // 2 | // LineAnimationView.m 3 | // AnimatedLineView 4 | // 5 | // Created by XianMingYou on 15/3/4. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "LineAnimationView.h" 12 | 13 | @implementation LineAnimationView 14 | 15 | - (instancetype)initWithFrame:(CGRect)frame { 16 | 17 | self = [super initWithFrame:frame]; 18 | 19 | if (self) { 20 | 21 | self.alpha = 0.f; 22 | self.maxAlpha = 0.1f; 23 | self.fadeToShowDuration = 1.75f; 24 | self.fadeToHideDuration = 0.75f; 25 | } 26 | 27 | return self; 28 | } 29 | 30 | - (void)show { 31 | 32 | } 33 | 34 | - (void)hide { 35 | 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /YoCelsius/LineBackgroundView.h: -------------------------------------------------------------------------------- 1 | // 2 | // LineBackgroundView.h 3 | // LineBackgroundView 4 | // 5 | // Created by XianMingYou on 15/3/4. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | 13 | @interface LineBackgroundView : UIView 14 | 15 | @property (nonatomic) CGFloat lineWidth; 16 | @property (nonatomic) CGFloat lineGap; 17 | @property (nonatomic, strong) UIColor *lineColor; 18 | 19 | - (void)buildView; 20 | + (instancetype)createViewWithFrame:(CGRect)frame LineWidth:(CGFloat)width lineGap:(CGFloat)lineGap lineColor:(UIColor *)color; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /YoCelsius/LoadingView.h: -------------------------------------------------------------------------------- 1 | // 2 | // LoadingView.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/23. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | 13 | @interface LoadingView : UIView 14 | 15 | /** 16 | * 静态图片 17 | */ 18 | @property (nonatomic, strong) UIImage *staticCircleImage; 19 | 20 | /** 21 | * 动画图片 22 | */ 23 | @property (nonatomic, strong) UIImage *animtedImage; 24 | 25 | /** 26 | * 显示 27 | */ 28 | - (void)show; 29 | 30 | /** 31 | * 隐藏 32 | */ 33 | - (void)hide; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /YoCelsius/LongTapAnimationView.h: -------------------------------------------------------------------------------- 1 | // 2 | // LongTapAnimationView.h 3 | // YouXianMingClock 4 | // 5 | // Created by YouXianMing on 14-10-13. 6 | // Copyright (c) 2014年 YouXianMing. All rights reserved. 7 | // 8 | 9 | #import 10 | @class LongTapAnimationView; 11 | 12 | @protocol LongTapAnimationViewDelegate 13 | 14 | /** 15 | * 长按百分比 16 | * 17 | * @param percent 百分比 18 | * @param view 自身 19 | */ 20 | - (void)longPressPercentage:(CGFloat)percent view:(LongTapAnimationView *)view; 21 | - (void)longPressCompleteWithView:(LongTapAnimationView *)view intNumber:(NSNumber *)number; 22 | 23 | @end 24 | 25 | @interface LongTapAnimationView : UIView 26 | 27 | /** 28 | * 代理 29 | */ 30 | @property (nonatomic, assign) id delegate; 31 | 32 | /** 33 | * 百分比 34 | */ 35 | @property (nonatomic, assign, readonly) CGFloat percent; 36 | 37 | /** 38 | * 缩放比例 39 | */ 40 | @property (nonatomic, assign) CGFloat scaleValue; 41 | 42 | /** 43 | * 时候允许按下(默认为YES) 44 | */ 45 | @property (nonatomic, assign) BOOL canTouch; 46 | 47 | /** 48 | * 多长时间才能表示已经按下按钮激活事件 49 | */ 50 | @property (nonatomic, assign) NSTimeInterval completeDurationAfterLongPress; 51 | 52 | /** 53 | * 倒计时时间(如果设置了倒计时时间,则completeDurationAfterLongPress会无效) 54 | */ 55 | @property (nonatomic, assign) NSInteger countDown; 56 | 57 | /** 58 | * 激活按钮事件 59 | */ 60 | - (void)activateButtonEffect; 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /YoCelsius/MainInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // MainInfo.h 3 | // 4 | // http://home.cnblogs.com/u/YouXianMing 5 | // https://github.com/YouXianMing 6 | // 7 | // Copyright (c) 2015 YouXianMing All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | @interface MainInfo : NSObject 13 | 14 | @property (nonatomic, strong) NSNumber *humidity; // Humidity, % 15 | @property (nonatomic, strong) NSNumber *temp_min; // Minimum temperature at the moment. This is deviation from current temp that is possible for large cities and megalopolises geographically expanded (use these parameter optionally) 16 | @property (nonatomic, strong) NSNumber *temp_max; // Maximum temperature at the moment. This is deviation from current temp that is possible for large cities and megalopolises geographically expanded (use these parameter optionally) 17 | @property (nonatomic, strong) NSNumber *temp; // Temperature, Kelvin (subtract 273.15 to convert to Celsius) 18 | @property (nonatomic, strong) NSNumber *pressure; // Atmospheric pressure (on the sea level, if there is no sea_level or grnd_level data), hPa 19 | @property (nonatomic, strong) NSNumber *sea_level; // Atmospheric pressure on the sea level, hPa 20 | @property (nonatomic, strong) NSNumber *grnd_level; // Atmospheric pressure on the ground level, hPa 21 | 22 | - (void)setValue:(id)value forUndefinedKey:(NSString *)key; 23 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary; 24 | 25 | @end 26 | 27 | -------------------------------------------------------------------------------- /YoCelsius/MainInfo.m: -------------------------------------------------------------------------------- 1 | // 2 | // MainInfo.m 3 | // 4 | // http://home.cnblogs.com/u/YouXianMing 5 | // https://github.com/YouXianMing 6 | // 7 | // Copyright (c) 2015 YouXianMing All rights reserved. 8 | // 9 | 10 | #import "MainInfo.h" 11 | 12 | @implementation MainInfo 13 | 14 | - (void)setValue:(id)value forUndefinedKey:(NSString *)key { 15 | 16 | } 17 | 18 | - (void)setValue:(id)value forKey:(NSString *)key { 19 | 20 | if ([value isKindOfClass:[NSNull class]]) { 21 | 22 | return; 23 | } 24 | 25 | [super setValue:value forKey:key]; 26 | } 27 | 28 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary { 29 | 30 | if ([dictionary isKindOfClass:[NSDictionary class]]) { 31 | 32 | self = [super init]; 33 | 34 | if (self) { 35 | 36 | [self setValuesForKeysWithDictionary:dictionary]; 37 | } 38 | 39 | return self; 40 | 41 | } else { 42 | 43 | return nil; 44 | } 45 | } 46 | 47 | @end -------------------------------------------------------------------------------- /YoCelsius/Map/MapManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // MapManager.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/15. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | @import CoreLocation; 13 | @class MapManager; 14 | 15 | @protocol MapManagerLocationDelegate 16 | 17 | @optional 18 | 19 | - (void)mapManager:(MapManager *)manager didUpdateAndGetLastCLLocation:(CLLocation *)location; 20 | - (void)mapManager:(MapManager *)manager didFailed:(NSError *)error; 21 | - (void)mapManagerServerClosed:(MapManager *)manager; 22 | 23 | @end 24 | 25 | @interface MapManager : NSObject 26 | 27 | @property (nonatomic, weak) id delegate; 28 | @property (nonatomic, readonly) CLAuthorizationStatus authorizationStatus; 29 | 30 | - (void)start; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /YoCelsius/MaxTempCount.h: -------------------------------------------------------------------------------- 1 | // 2 | // MaxTempCount.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/20. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "NumberCount.h" 12 | #import "NSString+RichText.h" 13 | 14 | @interface MaxTempCount : NumberCount 15 | 16 | - (void)startAnimation; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /YoCelsius/MaxTempCountLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // MaxTempCountLabel.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/20. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | #import "MaxTempCount.h" 13 | 14 | @interface MaxTempCountLabel : UIView 15 | 16 | /** 17 | * 起始值 18 | */ 19 | @property (nonatomic) CGFloat fromValue; 20 | 21 | /** 22 | * 结束值 23 | */ 24 | @property (nonatomic) CGFloat toValue; 25 | 26 | /** 27 | * 动画引擎 28 | */ 29 | @property (nonatomic, strong) MaxTempCount *maxTempCount; 30 | 31 | /** 32 | * 显示用的label 33 | */ 34 | @property (nonatomic, strong) UILabel *countLabel; 35 | 36 | /** 37 | * 显示动画 38 | * 39 | * @param duration 动画时间 40 | */ 41 | - (void)showDuration:(CGFloat)duration; 42 | 43 | /** 44 | * 隐藏动画 45 | * 46 | * @param duration 隐藏时间 47 | */ 48 | - (void)hideDuration:(CGFloat)duration; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /YoCelsius/MaxTempCountLabel.m: -------------------------------------------------------------------------------- 1 | // 2 | // MaxTempCountLabel.m 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/20. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "MaxTempCountLabel.h" 12 | 13 | @interface MaxTempCountLabel () 14 | 15 | @end 16 | 17 | @implementation MaxTempCountLabel 18 | 19 | - (instancetype)initWithFrame:(CGRect)frame { 20 | 21 | self = [super initWithFrame:frame]; 22 | 23 | if (self) { 24 | 25 | self.countLabel = [[UILabel alloc] initWithFrame:self.bounds]; 26 | self.countLabel.textAlignment = NSTextAlignmentLeft; 27 | [self addSubview:self.countLabel]; 28 | self.countLabel.alpha = 0; 29 | 30 | self.maxTempCount = [MaxTempCount new]; 31 | self.maxTempCount.delegate = self; 32 | 33 | } 34 | 35 | return self; 36 | } 37 | 38 | - (void)numberCount:(NumberCount *)numberCount currentSting:(NSAttributedString *)string { 39 | 40 | self.countLabel.attributedText = string; 41 | } 42 | 43 | - (void)showDuration:(CGFloat)duration { 44 | 45 | self.maxTempCount.fromValue = self.fromValue; 46 | self.maxTempCount.toValue = self.toValue; 47 | self.maxTempCount.duration = duration; 48 | 49 | [self.maxTempCount startAnimation]; 50 | 51 | [UIView animateWithDuration:duration animations:^{ 52 | 53 | self.countLabel.alpha = 1.f; 54 | }]; 55 | } 56 | 57 | - (void)hideDuration:(CGFloat)duration { 58 | 59 | self.maxTempCount.fromValue = self.toValue; 60 | self.maxTempCount.toValue = 0; 61 | self.maxTempCount.duration = duration; 62 | 63 | [self.maxTempCount startAnimation]; 64 | 65 | [UIView animateWithDuration:duration animations:^{ 66 | 67 | self.countLabel.alpha = 0.f; 68 | }]; 69 | } 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /YoCelsius/MaxTempView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MaxTempView.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/20. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | 13 | @interface MaxTempView : UIView 14 | 15 | /** 16 | * 最高温度 17 | */ 18 | @property (nonatomic) CGFloat maxTemp; 19 | 20 | /** 21 | * 最低温度 22 | */ 23 | @property (nonatomic) CGFloat minTemp; 24 | 25 | /** 26 | * 创建出view 27 | */ 28 | - (void)buildView; 29 | 30 | /** 31 | * 显示 32 | */ 33 | - (void)show; 34 | 35 | /** 36 | * 隐藏 37 | */ 38 | - (void)hide; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /YoCelsius/MinTempContLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // MinTempContLabel.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/20. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "NumberCount.h" 12 | #import "MinTempCount.h" 13 | 14 | @interface MinTempContLabel : UIView 15 | 16 | /** 17 | * 起始值 18 | */ 19 | @property (nonatomic) CGFloat fromValue; 20 | 21 | /** 22 | * 结束值 23 | */ 24 | @property (nonatomic) CGFloat toValue; 25 | 26 | /** 27 | * 动画引擎 28 | */ 29 | @property (nonatomic, strong) MinTempCount *minTempCount; 30 | 31 | /** 32 | * 显示用的label 33 | */ 34 | @property (nonatomic, strong) UILabel *countLabel; 35 | 36 | /** 37 | * 显示动画 38 | * 39 | * @param duration 动画时间 40 | */ 41 | - (void)showDuration:(CGFloat)duration; 42 | 43 | /** 44 | * 隐藏动画 45 | * 46 | * @param duration 隐藏时间 47 | */ 48 | - (void)hideDuration:(CGFloat)duration; 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /YoCelsius/MinTempContLabel.m: -------------------------------------------------------------------------------- 1 | // 2 | // MinTempContLabel.m 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/20. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "MinTempContLabel.h" 12 | 13 | @interface MinTempContLabel () 14 | 15 | @end 16 | 17 | @implementation MinTempContLabel 18 | 19 | - (instancetype)initWithFrame:(CGRect)frame { 20 | 21 | self = [super initWithFrame:frame]; 22 | 23 | if (self) { 24 | 25 | self.countLabel = [[UILabel alloc] initWithFrame:self.bounds]; 26 | self.countLabel.textAlignment = NSTextAlignmentLeft; 27 | [self addSubview:self.countLabel]; 28 | self.countLabel.alpha = 0; 29 | 30 | self.minTempCount = [MinTempCount new]; 31 | self.minTempCount.delegate = self; 32 | } 33 | 34 | return self; 35 | } 36 | 37 | - (void)numberCount:(NumberCount *)numberCount currentSting:(NSAttributedString *)string { 38 | 39 | self.countLabel.attributedText = string; 40 | } 41 | 42 | - (void)showDuration:(CGFloat)duration { 43 | 44 | self.minTempCount.fromValue = self.fromValue; 45 | self.minTempCount.toValue = self.toValue; 46 | self.minTempCount.duration = duration; 47 | 48 | [self.minTempCount startAnimation]; 49 | 50 | [UIView animateWithDuration:duration animations:^{ 51 | 52 | self.countLabel.alpha = 1.f; 53 | }]; 54 | } 55 | 56 | - (void)hideDuration:(CGFloat)duration { 57 | 58 | self.minTempCount.fromValue = self.toValue; 59 | self.minTempCount.toValue = 0; 60 | self.minTempCount.duration = duration; 61 | 62 | [self.minTempCount startAnimation]; 63 | 64 | [UIView animateWithDuration:duration animations:^{ 65 | 66 | self.countLabel.alpha = 0.f; 67 | }]; 68 | } 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /YoCelsius/MinTempCount.h: -------------------------------------------------------------------------------- 1 | // 2 | // MinTempCount.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/20. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "NumberCount.h" 12 | #import "NSString+RichText.h" 13 | 14 | @interface MinTempCount : NumberCount 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /YoCelsius/Networking+YoCelsius.h: -------------------------------------------------------------------------------- 1 | // 2 | // Networking+YoCelsius.h 3 | // YoCelsius 4 | // 5 | // Created by YouXianMing on 2017/11/8. 6 | // Copyright © 2017年 XianMingYou. All rights reserved. 7 | // 8 | 9 | #import "Networking.h" 10 | 11 | static NSString *baseURL = @"http://api.openweathermap.org/data/2.5"; 12 | 13 | typedef enum : NSUInteger { 14 | 15 | kWeather = 1000, 16 | kForecastDaily, 17 | 18 | } ENetworkConfigTagValue; 19 | 20 | #pragma mark - NetworkConfig 21 | 22 | @interface NetworkConfig : NSObject 23 | 24 | @property (nonatomic, strong) NSString *urlString; 25 | @property (nonatomic, strong) NSString *functionName; 26 | @property (nonatomic) NSInteger tag; 27 | @property (nonatomic) ENetworkingMethod method; 28 | 29 | @end 30 | 31 | /** 32 | * [GET] Current Weather Request. (/weather) 33 | */ 34 | static inline NetworkConfig *weather() { 35 | 36 | NetworkConfig *config = [NetworkConfig new]; 37 | config.urlString = [baseURL stringByAppendingString:@"/weather"]; 38 | config.functionName = @"Current Weather Request."; 39 | config.tag = kWeather; 40 | config.method = kNetworkingGET; 41 | 42 | return config; 43 | } 44 | 45 | /** 46 | * [GET] Forecast Daily. (/forecast/daily) 47 | */ 48 | static inline NetworkConfig *forecastDaily() { 49 | 50 | NetworkConfig *config = [NetworkConfig new]; 51 | config.urlString = [baseURL stringByAppendingString:@"/forecast/daily"]; 52 | config.functionName = @"Forecast Daily."; 53 | config.tag = kForecastDaily; 54 | config.method = kNetworkingGET; 55 | 56 | return config; 57 | } 58 | 59 | @interface Networking (YoCelsius) 60 | 61 | + (instancetype)networkingWithNetworkConfig:(NetworkConfig *)config requestParameter:(id)requestParameter delegate:(id )delegate; 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /YoCelsius/Networking+YoCelsius.m: -------------------------------------------------------------------------------- 1 | // 2 | // Networking+YoCelsius.m 3 | // YoCelsius 4 | // 5 | // Created by YouXianMing on 2017/11/8. 6 | // Copyright © 2017年 XianMingYou. All rights reserved. 7 | // 8 | 9 | #import "Networking+YoCelsius.h" 10 | #import "YoCelsiusRequestParameterSerializer.h" 11 | #import "YoCelsiusNetworkingInfo.h" 12 | 13 | @implementation NetworkConfig 14 | 15 | @end 16 | 17 | @implementation Networking (YoCelsius) 18 | 19 | + (instancetype)networkingWithNetworkConfig:(NetworkConfig *)config requestParameter:(id)requestParameter delegate:(id )delegate { 20 | 21 | Networking *networking = [Networking networkingWithUrlString:config.urlString 22 | requestParameter:requestParameter 23 | method:config.method 24 | requestParameterSerializer:[YoCelsiusRequestParameterSerializer new] 25 | responseDataSerializer:nil 26 | constructingBodyWithBlock:nil 27 | progress:nil 28 | tag:config.tag 29 | delegate:delegate 30 | requestSerializer:[AFHTTPRequestSerializer serializer] 31 | responseSerializer:[AFJSONResponseSerializer serializer]]; 32 | networking.timeoutInterval = @(8.f); 33 | networking.serviceInfo = config.functionName; 34 | networking.networkingInfo = [YoCelsiusNetworkingInfo new]; 35 | 36 | return networking; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /YoCelsius/NetworkingInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // NetworkingInfo.h 3 | // Networking 4 | // 5 | // Created by YouXianMing on 2017/8/18. 6 | // Copyright © 2017年 TechCode. All rights reserved. 7 | // 8 | 9 | #import 10 | @class Networking; 11 | 12 | @interface NetworkingInfo : NSObject 13 | 14 | @property (nonatomic, weak) Networking *networking; 15 | 16 | /** 17 | * 显示信息 18 | */ 19 | - (void)showMessage; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /YoCelsius/NetworkingInfo.m: -------------------------------------------------------------------------------- 1 | // 2 | // NetworkingInfo.m 3 | // Networking 4 | // 5 | // Created by YouXianMing on 2017/8/18. 6 | // Copyright © 2017年 TechCode. All rights reserved. 7 | // 8 | 9 | #import "NetworkingInfo.h" 10 | #import "Networking.h" 11 | 12 | @implementation NetworkingInfo 13 | 14 | - (void)showMessage { 15 | 16 | NSString *method = nil; 17 | switch (self.networking.method) { 18 | 19 | case kNetworkingGET: 20 | method = @"GET"; 21 | break; 22 | 23 | case kNetworkingPOST: 24 | method = @"POST"; 25 | break; 26 | 27 | case kNetworkingUPLOAD: 28 | method = @"UPLOAD"; 29 | break; 30 | 31 | default: 32 | break; 33 | } 34 | 35 | NSMutableString *string = [NSMutableString string]; 36 | 37 | [string appendString:@"\n\n-------------------------------------------------------------------------\n"]; 38 | 39 | if (self.networking.serviceInfo) { 40 | 41 | [string appendFormat:@"服务描述: %@\n\n", self.networking.serviceInfo]; 42 | } 43 | 44 | [string appendFormat:@"服务地址: [%@] %@\n\n", method, self.networking.urlString]; 45 | 46 | if (self.networking.responseSerializer.acceptableContentTypes.allObjects.count) { 47 | 48 | [string appendFormat:@"Response ContentTypes: %@\n\n", self.networking.responseSerializer.acceptableContentTypes]; 49 | } 50 | 51 | if (self.networking.HTTPHeaderFieldsWithValues.allKeys.count) { 52 | 53 | [string appendFormat:@"头部信息: \n%@\n", self.networking.HTTPHeaderFieldsWithValues]; 54 | } 55 | 56 | if (self.networking.requestParameter) { 57 | 58 | [string appendFormat:@"参数列表: \n%@\n", [self.networking.requestParameterSerializer serializeRequestParameter:self.networking.requestParameter]]; 59 | } 60 | 61 | [string appendString:@"-------------------------------------------------------------------------\n"]; 62 | 63 | NSLog(@"%@", string); 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /YoCelsius/NumberCount.h: -------------------------------------------------------------------------------- 1 | // 2 | // NumberCount.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/18. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | @class NumberCount; 13 | 14 | @protocol NumberCountDelegate 15 | 16 | @optional 17 | /** 18 | * 最原始的方法 19 | * 20 | * @param numberCount 对象自己 21 | * @param number 变化的值 22 | */ 23 | - (void)numberCount:(NumberCount *)numberCount currentNumber:(NSNumber *)number; 24 | 25 | /** 26 | * 子类可以实现的方法 27 | * 28 | * @param numberCount 对象自己 29 | * @param string 子类返回的富文本 30 | */ 31 | - (void)numberCount:(NumberCount *)numberCount currentSting:(NSAttributedString *)string; 32 | 33 | @end 34 | 35 | @interface NumberCount : NSObject 36 | 37 | /** 38 | * 代理 39 | */ 40 | @property (nonatomic, weak) id delegate; 41 | 42 | /** 43 | * 动画实体 44 | */ 45 | @property (nonatomic, strong) POPBasicAnimation *conutAnimation; 46 | 47 | /** 48 | * 初始值 49 | */ 50 | @property (nonatomic) CGFloat fromValue; 51 | 52 | /** 53 | * 结束值 54 | */ 55 | @property (nonatomic) CGFloat toValue; 56 | 57 | /** 58 | * 动画持续时间 59 | */ 60 | @property (nonatomic) CGFloat duration; 61 | 62 | /** 63 | * 开始动画 64 | */ 65 | - (void)startAnimation; 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /YoCelsius/NumberCount.m: -------------------------------------------------------------------------------- 1 | // 2 | // NumberCount.m 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/18. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "NumberCount.h" 12 | #import "POP.h" 13 | 14 | @implementation NumberCount 15 | 16 | - (instancetype)init { 17 | 18 | self = [super init]; 19 | 20 | if (self) { 21 | 22 | self.conutAnimation = [POPBasicAnimation animation]; 23 | 24 | } 25 | 26 | return self; 27 | } 28 | 29 | - (void)startAnimation { 30 | 31 | // 初始化值 32 | CGFloat fromeValue = self.fromValue; 33 | CGFloat toValue = self.toValue; 34 | CGFloat duration = (self.duration <= 0 ? 1.f : self.duration); 35 | 36 | // 设定动画 37 | self.conutAnimation.fromValue = @(fromeValue); 38 | self.conutAnimation.toValue = @(toValue); 39 | self.conutAnimation.timingFunction = \ 40 | [CAMediaTimingFunction functionWithControlPoints:0.69 :0.11 :0.32 :0.88]; 41 | self.conutAnimation.duration = duration; 42 | 43 | // 只有执行了代理才会执行计数引擎 44 | if (self.delegate && [self.delegate respondsToSelector:@selector(numberCount:currentNumber:)]) { 45 | 46 | /* 将计算出来的值通过writeBlock动态给控件设定 */ 47 | self.conutAnimation.property = \ 48 | [POPMutableAnimatableProperty propertyWithName:@"conutAnimation" 49 | initializer:^(POPMutableAnimatableProperty *prop) { 50 | prop.writeBlock = ^(id obj, const CGFloat values[]) { 51 | NSNumber *number = @(values[0]); 52 | [self->_delegate numberCount:self currentNumber:number]; 53 | }; 54 | }]; 55 | 56 | // 添加动画 57 | [self pop_addAnimation:self.conutAnimation forKey:nil]; 58 | } 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /YoCelsius/PathDirectionView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PathDirectionView.h 3 | // Path 4 | // 5 | // Created by XianMingYou on 15/2/27. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | #import "UIView+SetRect.h" 13 | 14 | @interface PathDirectionView : UIView 15 | 16 | /** 17 | * 起始点在右边 18 | */ 19 | @property (nonatomic) BOOL startPointAtRight; 20 | 21 | /** 22 | * 根据百分比显示 23 | * 24 | * @param percent 百分比 25 | */ 26 | - (void)showPercent:(CGFloat)percent; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /YoCelsius/PresentingAnimator.h: -------------------------------------------------------------------------------- 1 | // 2 | // PresentingAnimator.h 3 | // 4 | // Copyright (c) 2014年 Y.X. All rights reserved. 5 | // 6 | 7 | #import 8 | #import 9 | 10 | @interface PresentingAnimator : NSObject 11 | 12 | @end -------------------------------------------------------------------------------- /YoCelsius/PresentingAnimator.m: -------------------------------------------------------------------------------- 1 | // 2 | // PresentingAnimator.m 3 | // 4 | // Copyright (c) 2014年 Y.X. All rights reserved. 5 | // 6 | 7 | #import "PresentingAnimator.h" 8 | #import "UIView+SetRect.h" 9 | 10 | @implementation PresentingAnimator 11 | 12 | // 转场动画时间 13 | - (NSTimeInterval)transitionDuration:(id )transitionContext { 14 | 15 | return 1.f; 16 | } 17 | 18 | - (void)animateTransition:(id )transitionContext { 19 | 20 | // 另一个view 21 | UIView *toView = [transitionContext viewForKey:UITransitionContextToViewKey]; 22 | toView.y = Height; 23 | 24 | // 管理容器 25 | UIView *container = [transitionContext containerView]; 26 | 27 | // 容器中添加推出的view 28 | [container addSubview:toView]; 29 | 30 | // 动画时间 31 | CGFloat duration = [self transitionDuration:transitionContext]; 32 | 33 | // 开始点 + 结束点 34 | CGPoint startPoint = toView.center; 35 | CGPoint endPoint = container.center; 36 | 37 | // 关键帧动画 38 | CAKeyframeAnimation *keyAnimation = [CAKeyframeAnimation animation]; 39 | keyAnimation.keyPath = @"position"; 40 | keyAnimation.values = [YXEasing calculateFrameFromPoint:startPoint toPoint:endPoint 41 | func:ExponentialEaseOut frameCount:duration * 60.f]; 42 | keyAnimation.duration = duration; 43 | toView.center = container.center; 44 | [toView.layer addAnimation:keyAnimation forKey:nil]; 45 | 46 | [GCDQueue executeInMainQueue:^{ 47 | 48 | [transitionContext completeTransition:YES]; 49 | 50 | } afterDelaySecs:duration]; 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /YoCelsius/PressAnimationButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // PressAnimationButton.h 3 | // Button 4 | // 5 | // Created by XianMingYou on 15/1/30. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | @class PressAnimationButton; 13 | 14 | @protocol PressAnimationButtonDelegate 15 | 16 | - (void)finishedEventWith:(PressAnimationButton *)button; 17 | 18 | @end 19 | 20 | @interface PressAnimationButton : UIView 21 | 22 | @property (nonatomic, strong) UIFont *font; 23 | @property (nonatomic, strong) NSString *text; 24 | 25 | @property (nonatomic, strong) UIColor *normalTextColor; 26 | @property (nonatomic, strong) UIColor *highlightTextColor; 27 | 28 | @property (nonatomic, strong) UIColor *animationColor; 29 | @property (nonatomic) CGFloat animationWidth; // 动画的宽度 30 | 31 | @property (nonatomic, weak) id delegate; // 代理 32 | 33 | /** 34 | * 动画结束 + 恢复正常的时间 35 | */ 36 | @property (nonatomic) CGFloat toEndDuration; 37 | @property (nonatomic) CGFloat toNormalDuration; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /YoCelsius/RainView.h: -------------------------------------------------------------------------------- 1 | // 2 | // RainView.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/3/4. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "EmitterLayerView.h" 12 | 13 | @interface RainView : EmitterLayerView 14 | 15 | @property (nonatomic, strong) UIImage *snowImage; 16 | 17 | @property (nonatomic, assign) CGFloat lifetime; // 生命周期 18 | @property (nonatomic, assign) CGFloat birthRate; // 出生率 19 | @property (nonatomic, assign) CGFloat speed; // 雪花速率 20 | @property (nonatomic, assign) CGFloat speedRange; // 速率变化范围 [speed - speedRange , speed + speedRange] 21 | @property (nonatomic, assign) CGFloat gravity; // 重力 22 | @property (nonatomic, strong) UIColor *snowColor; // 雪花颜色 23 | 24 | - (void)showSnow; 25 | - (void)show; 26 | - (void)hide; 27 | - (void)configType:(EMitterType)type; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /YoCelsius/RequestBodyType.h: -------------------------------------------------------------------------------- 1 | // 2 | // RequestBodyType.h 3 | // Networking 4 | // 5 | // Created by YouXianMing on 15/11/6. 6 | // 7 | // http://www.cnblogs.com/YouXianMing/ 8 | // https://github.com/YouXianMing 9 | // 10 | 11 | #import 12 | 13 | @interface RequestBodyType : NSObject 14 | 15 | + (instancetype)type; 16 | 17 | @end 18 | 19 | @interface HttpBodyType : RequestBodyType 20 | 21 | @end 22 | 23 | @interface JsonBodyType : RequestBodyType 24 | 25 | @end 26 | 27 | @interface PlistBodyType : RequestBodyType 28 | 29 | @end -------------------------------------------------------------------------------- /YoCelsius/RequestBodyType.m: -------------------------------------------------------------------------------- 1 | // 2 | // RequestBodyType.m 3 | // Networking 4 | // 5 | // Created by YouXianMing on 15/11/6. 6 | // 7 | // http://www.cnblogs.com/YouXianMing/ 8 | // https://github.com/YouXianMing 9 | // 10 | 11 | #import "RequestBodyType.h" 12 | 13 | @implementation RequestBodyType 14 | 15 | + (instancetype)type { 16 | 17 | RequestBodyType *bodyType = [[[self class] alloc] init]; 18 | return bodyType; 19 | } 20 | 21 | @end 22 | 23 | @implementation HttpBodyType 24 | 25 | @end 26 | 27 | @implementation JsonBodyType 28 | 29 | @end 30 | 31 | @implementation PlistBodyType 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /YoCelsius/RequestMethodType.h: -------------------------------------------------------------------------------- 1 | // 2 | // RequestMethodType.h 3 | // Networking 4 | // 5 | // Created by YouXianMing on 15/11/6. 6 | // 7 | // http://www.cnblogs.com/YouXianMing/ 8 | // https://github.com/YouXianMing 9 | // 10 | 11 | #import 12 | 13 | @interface RequestMethodType : NSObject 14 | 15 | + (instancetype)type; 16 | 17 | @end 18 | 19 | @interface GetMethod : RequestMethodType 20 | 21 | @end 22 | 23 | @interface PostMethod : RequestMethodType 24 | 25 | @end -------------------------------------------------------------------------------- /YoCelsius/RequestMethodType.m: -------------------------------------------------------------------------------- 1 | // 2 | // RequestMethodType.m 3 | // Networking 4 | // 5 | // Created by YouXianMing on 15/11/6. 6 | // 7 | // http://www.cnblogs.com/YouXianMing/ 8 | // https://github.com/YouXianMing 9 | // 10 | 11 | #import "RequestMethodType.h" 12 | 13 | @implementation RequestMethodType 14 | 15 | + (instancetype)type { 16 | 17 | RequestMethodType *method = [[[self class] alloc] init]; 18 | return method; 19 | } 20 | 21 | @end 22 | 23 | @implementation GetMethod 24 | 25 | @end 26 | 27 | @implementation PostMethod 28 | 29 | @end -------------------------------------------------------------------------------- /YoCelsius/RequestParameterSerializer.h: -------------------------------------------------------------------------------- 1 | // 2 | // RequestParameterSerializer.h 3 | // Networking 4 | // 5 | // Created by YouXianMing on 2017/8/18. 6 | // Copyright © 2017年 TechCode. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RequestParameterSerializer : NSObject 12 | 13 | /** 14 | * 处理请求参数 15 | * 16 | * @param requestParameter 请求参数 17 | * 18 | * @return 处理后的参数 19 | */ 20 | - (id)serializeRequestParameter:(id)requestParameter; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /YoCelsius/RequestParameterSerializer.m: -------------------------------------------------------------------------------- 1 | // 2 | // RequestParameterSerializer.m 3 | // Networking 4 | // 5 | // Created by YouXianMing on 2017/8/18. 6 | // Copyright © 2017年 TechCode. All rights reserved. 7 | // 8 | 9 | #import "RequestParameterSerializer.h" 10 | 11 | @implementation RequestParameterSerializer 12 | 13 | - (id)serializeRequestParameter:(id)requestParameter { 14 | 15 | return requestParameter; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /YoCelsius/ResponseDataManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // ResponseDataManager.h 3 | // EDU 4 | // 5 | // Created by YouXianMing on 2017/8/19. 6 | // Copyright © 2017年 TechCode. All rights reserved. 7 | // 8 | 9 | #import 10 | @class Networking; 11 | 12 | @interface ResponseDataManager : NSObject 13 | 14 | - (void)requestSuccess:(BOOL)success networking:(Networking *)networking; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /YoCelsius/ResponseDataManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // ResponseDataManager.m 3 | // EDU 4 | // 5 | // Created by YouXianMing on 2017/8/19. 6 | // Copyright © 2017年 TechCode. All rights reserved. 7 | // 8 | 9 | #import "ResponseDataManager.h" 10 | 11 | @implementation ResponseDataManager 12 | 13 | - (void)requestSuccess:(BOOL)success networking:(Networking *)networking { 14 | 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /YoCelsius/ResponseDataSerializer.h: -------------------------------------------------------------------------------- 1 | // 2 | // ResponseDataSerializer.h 3 | // Networking 4 | // 5 | // Created by YouXianMing on 2017/8/18. 6 | // Copyright © 2017年 TechCode. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ResponseDataSerializer : NSObject 12 | 13 | /** 14 | * 处理返回的参数 15 | * 16 | * @param data 处理前的参数 17 | * 18 | * @return 处理后的参数 19 | */ 20 | - (id)serializeResponseData:(id)data; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /YoCelsius/ResponseDataSerializer.m: -------------------------------------------------------------------------------- 1 | // 2 | // ResponseDataSerializer.m 3 | // Networking 4 | // 5 | // Created by YouXianMing on 2017/8/18. 6 | // Copyright © 2017年 TechCode. All rights reserved. 7 | // 8 | 9 | #import "ResponseDataSerializer.h" 10 | 11 | @implementation ResponseDataSerializer 12 | 13 | - (id)serializeResponseData:(id)data { 14 | 15 | return data; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /YoCelsius/ResponseDataType.h: -------------------------------------------------------------------------------- 1 | // 2 | // ResponseDataType.h 3 | // Networking 4 | // 5 | // Created by YouXianMing on 15/11/6. 6 | // 7 | // http://www.cnblogs.com/YouXianMing/ 8 | // https://github.com/YouXianMing 9 | // 10 | 11 | #import 12 | 13 | @interface ResponseDataType : NSObject 14 | 15 | + (instancetype)type; 16 | 17 | @end 18 | 19 | @interface JsonDataType : ResponseDataType 20 | 21 | @end 22 | 23 | @interface HttpDataType : ResponseDataType 24 | 25 | @end -------------------------------------------------------------------------------- /YoCelsius/ResponseDataType.m: -------------------------------------------------------------------------------- 1 | // 2 | // ResponseDataType.m 3 | // Networking 4 | // 5 | // Created by YouXianMing on 15/11/6. 6 | // 7 | // http://www.cnblogs.com/YouXianMing/ 8 | // https://github.com/YouXianMing 9 | // 10 | 11 | #import "ResponseDataType.h" 12 | 13 | @implementation ResponseDataType 14 | 15 | + (instancetype)type { 16 | 17 | ResponseDataType *responseData = [[[self class] alloc] init]; 18 | return responseData; 19 | } 20 | 21 | @end 22 | 23 | @implementation JsonDataType 24 | 25 | @end 26 | 27 | @implementation HttpDataType 28 | 29 | @end -------------------------------------------------------------------------------- /YoCelsius/RichText/ConfigAttributedString.h: -------------------------------------------------------------------------------- 1 | // 2 | // ConfigAttributedString.h 3 | // NSMutableAttributedString 4 | // 5 | // Copyright (c) 2014年 Y.X. All rights reserved. 6 | // 7 | 8 | #import 9 | #import 10 | 11 | @interface ConfigAttributedString : NSObject 12 | 13 | @property (nonatomic, strong, readonly) NSString *attribute; // 富文本属性 14 | @property (nonatomic, strong, readonly) id value; // 富文本值 15 | @property (nonatomic, assign, readonly) NSRange range; // 富文本范围值 16 | 17 | // 通用型配置 18 | + (instancetype)attribute:(NSString *)attribute value:(id)value range:(NSRange)range; 19 | 20 | // 配置字体 21 | + (instancetype)font:(UIFont *)font range:(NSRange)range; 22 | 23 | // 配置字体颜色 24 | + (instancetype)foregroundColor:(UIColor *)color range:(NSRange)range; 25 | 26 | // 配置字体背景颜色 27 | + (instancetype)backgroundColor:(UIColor *)color range:(NSRange)range; 28 | 29 | // 字体描边颜色以及描边宽度以及阴影(以下两个方法可以一起使用) 30 | + (instancetype)strokeColor:(UIColor *)color range:(NSRange)range; 31 | + (instancetype)strokeWidth:(float)number range:(NSRange)range; 32 | + (instancetype)shadow:(NSShadow *)shadow range:(NSRange)range; 33 | 34 | // 配置文字的中划线 35 | + (instancetype)strikethroughStyle:(NSInteger)number range:(NSRange)range; 36 | 37 | // 配置文字的下划线 38 | + (instancetype)underlineStyle:(NSInteger)number range:(NSRange)range; 39 | 40 | // 字间距 41 | + (instancetype)kern:(float)number range:(NSRange)range; 42 | 43 | // 段落样式(需要将UILabel中的numberOfLines设置成0才有用) 44 | + (instancetype)paragraphStyle:(NSMutableParagraphStyle *)style range:(NSRange)range; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /YoCelsius/RichText/NSString+RichText.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+RichText.h 3 | // Category 4 | // 5 | // Created by YouXianMing on 14-8-28. 6 | // Copyright (c) 2014年 YouXianMing. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ConfigAttributedString.h" 11 | 12 | @interface NSString (RichText) 13 | 14 | // 创建富文本并配置富文本(NSArray中的数据必须是ConfigAttributedString对象合集) 15 | - (NSMutableAttributedString *)createAttributedStringAndConfig:(NSArray *)configs; 16 | 17 | // 用于搜寻一段字符串在另外一段字符串中的NSRange值 18 | - (NSRange)rangeFrom:(NSString *)string; 19 | 20 | // 本字符串的range 21 | - (NSRange)range; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /YoCelsius/RichText/NSString+RichText.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+RichText.m 3 | // Category 4 | // 5 | // Created by YouXianMing on 14-8-28. 6 | // Copyright (c) 2014年 YouXianMing. All rights reserved. 7 | // 8 | 9 | #import "NSString+RichText.h" 10 | 11 | @implementation NSString (RichText) 12 | 13 | - (NSMutableAttributedString *)createAttributedStringAndConfig:(NSArray *)configs 14 | { 15 | NSMutableAttributedString *attributedString = \ 16 | [[NSMutableAttributedString alloc] initWithString:self]; 17 | 18 | [configs enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { 19 | ConfigAttributedString *oneConfig = obj; 20 | [attributedString addAttribute:oneConfig.attribute 21 | value:oneConfig.value 22 | range:oneConfig.range]; 23 | }]; 24 | 25 | return attributedString; 26 | } 27 | 28 | - (NSRange)rangeFrom:(NSString *)string 29 | { 30 | return [string rangeOfString:self]; 31 | } 32 | 33 | - (NSRange)range 34 | { 35 | return NSMakeRange(0, self.length); 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /YoCelsius/RotatedAngleView.h: -------------------------------------------------------------------------------- 1 | // 2 | // RotatedAngleView.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/18. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | 13 | @interface RotatedAngleView : UIView 14 | 15 | /** 16 | * 旋转角度与持续时间 17 | * 18 | * @param angle 旋转角度 19 | * @param duration 持续时间 20 | */ 21 | - (void)roateAngle:(CGFloat)angle duration:(CGFloat)duration; 22 | 23 | /** 24 | * 旋转角度 25 | * 26 | * @param angle 旋转角度 27 | */ 28 | - (void)roateAngle:(CGFloat)angle; 29 | 30 | /** 31 | * 恢复动画效果 32 | * 33 | * @param duration 恢复的时间 34 | */ 35 | - (void)recoverDuration:(CGFloat)duration; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /YoCelsius/RotatedAngleView.m: -------------------------------------------------------------------------------- 1 | // 2 | // RotatedAngleView.m 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/18. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "RotatedAngleView.h" 12 | 13 | // 将度数转换为弧度 14 | #define RADIAN(degrees) ((M_PI * (degrees))/ 180.f) 15 | 16 | // 将弧度转换为度数 17 | #define DEGREES(radian) ((radian) * 180.f / M_PI) 18 | 19 | @interface RotatedAngleView () 20 | 21 | /** 22 | * 默认的旋转值 23 | */ 24 | @property (nonatomic, assign) CGAffineTransform defaultTransform; 25 | 26 | @end 27 | 28 | @implementation RotatedAngleView 29 | 30 | - (instancetype)initWithFrame:(CGRect)frame { 31 | 32 | self = [super initWithFrame:frame]; 33 | 34 | if (self) { 35 | 36 | // 存储默认的旋转值 37 | self.defaultTransform = self.transform; 38 | } 39 | 40 | return self; 41 | } 42 | 43 | - (void)roateAngle:(CGFloat)angle duration:(CGFloat)duration { 44 | 45 | [UIView animateWithDuration:duration animations:^{ 46 | 47 | self.transform = CGAffineTransformRotate(self->_defaultTransform, RADIAN(angle)); 48 | 49 | } completion:^(BOOL finished) { 50 | 51 | }]; 52 | } 53 | 54 | - (void)roateAngle:(CGFloat)angle { 55 | 56 | self.transform = CGAffineTransformRotate(_defaultTransform, RADIAN(angle)); 57 | } 58 | 59 | - (void)recoverDuration:(CGFloat)duration { 60 | 61 | [UIView animateWithDuration:duration animations:^{ 62 | 63 | self.transform = CGAffineTransformRotate(self->_defaultTransform, 0); 64 | 65 | } completion:^(BOOL finished) { 66 | 67 | }]; 68 | } 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /YoCelsius/ShapeWordView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ShapeWordView.h 3 | // PathWord 4 | // 5 | // Created by XianMingYou on 15/3/6. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | #import "UIBezierPath+TextPaths.h" 13 | 14 | @interface ShapeWordView : UIView 15 | 16 | @property (nonatomic, strong) NSString *text; 17 | @property (nonatomic, strong) UIFont *font; 18 | @property (nonatomic, strong) UIColor *lineColor; 19 | @property (nonatomic, assign) CGFloat lineWidth; 20 | 21 | /** 22 | * 创建view 23 | */ 24 | - (void)buildView; 25 | 26 | /** 27 | * 百分比 28 | * 29 | * @param percent 百分比 30 | */ 31 | - (void)percent:(CGFloat)percent animated:(BOOL)animated; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /YoCelsius/ShowDownView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ShowDownView.h 3 | // Path 4 | // 5 | // Created by XianMingYou on 15/2/27. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | #import "PathDirectionView.h" 13 | 14 | @interface ShowDownView : UIView 15 | 16 | - (void)showPercent:(CGFloat)percent; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /YoCelsius/ShowDownView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ShowDownView.m 3 | // Path 4 | // 5 | // Created by XianMingYou on 15/2/27. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "ShowDownView.h" 12 | 13 | @interface ShowDownView () 14 | 15 | @property (nonatomic, strong) PathDirectionView *leftView; 16 | @property (nonatomic, strong) PathDirectionView *rightView; 17 | 18 | @end 19 | 20 | @implementation ShowDownView 21 | 22 | - (instancetype)initWithFrame:(CGRect)frame { 23 | 24 | self = [super initWithFrame:frame]; 25 | 26 | if (self) { 27 | 28 | CGFloat width = frame.size.width / 2.f; 29 | CGFloat height = frame.size.height; 30 | 31 | CGRect leftRect = CGRectMake(0, 0, width, height); 32 | CGRect rightRect = CGRectMake(width, 0, width, height); 33 | 34 | self.leftView = [[PathDirectionView alloc] initWithFrame:leftRect]; 35 | self.rightView = [[PathDirectionView alloc] initWithFrame:rightRect]; 36 | self.rightView.startPointAtRight = YES; 37 | [self addSubview:self.leftView]; 38 | [self addSubview:self.rightView]; 39 | } 40 | 41 | return self; 42 | } 43 | 44 | - (void)showPercent:(CGFloat)percent { 45 | 46 | [self.leftView showPercent:percent]; 47 | [self.rightView showPercent:percent]; 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /YoCelsius/SnowView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SnowView.h 3 | // TestCAEmitterLayer 4 | // 5 | // Created by YouXianMing on 14/10/17. 6 | // Copyright (c) 2014年 YouXianMing. All rights reserved. 7 | // 8 | 9 | #import "EmitterLayerView.h" 10 | 11 | @interface SnowView : EmitterLayerView 12 | 13 | @property (nonatomic, strong) UIImage *snowImage; 14 | 15 | @property (nonatomic, assign) CGFloat lifetime; // 生命周期 16 | @property (nonatomic, assign) CGFloat birthRate; // 出生率 17 | @property (nonatomic, assign) CGFloat speed; // 雪花速率 18 | @property (nonatomic, assign) CGFloat speedRange; // 速率变化范围 [speed - speedRange , speed + speedRange] 19 | @property (nonatomic, assign) CGFloat gravity; // 重力 20 | @property (nonatomic, strong) UIColor *snowColor; // 雪花颜色 21 | 22 | - (void)showSnow; 23 | - (void)show; 24 | - (void)hide; 25 | - (void)configType:(EMitterType)type; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /YoCelsius/StringHeightAndWidth/NSString+StringHeight.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+StringHeight.h 3 | // USA 4 | // 5 | // Created by YouXianMing on 14/12/10. 6 | // Copyright (c) 2014年 fuhuaqi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSString (StringHeight) 12 | 13 | /** 14 | * 计算文本的高度 15 | * 16 | * @param font 字体 17 | * @param width 固定的宽度 18 | * 19 | * @return 高度 20 | */ 21 | - (CGFloat)heightWithLabelFont:(UIFont *)font withLabelWidth:(CGFloat)width; 22 | 23 | /** 24 | * 计算文本的宽度 25 | * 26 | * @param font 字体 27 | * 28 | * @return 宽度 29 | */ 30 | - (CGFloat)widthWithLabelFont:(UIFont *)font; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /YoCelsius/Sun.h: -------------------------------------------------------------------------------- 1 | // 2 | // Sun.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/21. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | 13 | @interface Sun : UIView 14 | 15 | @property (nonatomic) CGRect upCenterRect; 16 | @property (nonatomic) CGRect downCenterRect; 17 | 18 | /** 19 | * 显示动画 20 | * 21 | * @param duration 动画时间 22 | */ 23 | - (void)showWithDuration:(CGFloat)duration; 24 | 25 | /** 26 | * 隐藏动画 27 | * 28 | * @param duration 动画时间 29 | */ 30 | - (void)hideWithDuration:(CGFloat)duration; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /YoCelsius/Sun.m: -------------------------------------------------------------------------------- 1 | // 2 | // Sun.m 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/21. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "Sun.h" 12 | 13 | @implementation Sun 14 | 15 | - (instancetype)initWithFrame:(CGRect)frame { 16 | 17 | self = [super initWithFrame:frame]; 18 | 19 | if (self) { 20 | 21 | [self initRects]; 22 | } 23 | 24 | return self; 25 | } 26 | 27 | /** 28 | * 初始化view 29 | */ 30 | - (void)initRects { 31 | 32 | CGFloat width = self.width; 33 | CGFloat height = self.height / 2.f; 34 | 35 | self.upCenterRect = CGRectMake(0, 0, width, height); 36 | self.downCenterRect = CGRectMake(0, height, width, height); 37 | } 38 | 39 | /** 40 | * 显示动画 41 | * 42 | * @param duration 动画时间 43 | */ 44 | - (void)showWithDuration:(CGFloat)duration { 45 | 46 | } 47 | 48 | /** 49 | * 隐藏动画 50 | * 51 | * @param duration 动画时间 52 | */ 53 | - (void)hideWithDuration:(CGFloat)duration { 54 | 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /YoCelsius/SunInfoView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SunInfoView.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/21. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | #import "SunriseAndSunset.h" 13 | 14 | @interface SunInfoView : UIView 15 | 16 | /** 17 | * 日出的值 18 | */ 19 | @property (nonatomic, strong) SunriseAndSunset *sunsireValue; 20 | 21 | /** 22 | * 日落的值 23 | */ 24 | @property (nonatomic, strong) SunriseAndSunset *sunsetValue; 25 | 26 | /** 27 | * 创建出view 28 | */ 29 | - (void)buildView; 30 | 31 | /** 32 | * 显示 33 | */ 34 | - (void)show; 35 | 36 | /** 37 | * 隐藏 38 | */ 39 | - (void)hide; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /YoCelsius/SunriseAndSunset.h: -------------------------------------------------------------------------------- 1 | // 2 | // SunriseAndSunset.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/21. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | 13 | @interface SunriseAndSunset : NSObject 14 | 15 | @property (nonatomic) NSTimeInterval utcSec; // 获取到的UTC时间 16 | @property (nonatomic, strong, readonly) NSString *timeString; // 时间字符串 17 | 18 | /** 19 | * 开始处理时间信息 20 | */ 21 | - (void)accessUtcSec; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /YoCelsius/SunriseAndSunset.m: -------------------------------------------------------------------------------- 1 | // 2 | // SunriseAndSunset.m 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/21. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "SunriseAndSunset.h" 12 | 13 | @interface SunriseAndSunset () 14 | 15 | @property (nonatomic, strong) NSDateFormatter *formatter; 16 | @property (nonatomic, strong) NSString *timeString; 17 | 18 | @end 19 | 20 | @implementation SunriseAndSunset 21 | 22 | - (instancetype)init { 23 | 24 | self = [super init]; 25 | 26 | if (self) { 27 | 28 | self.formatter = [NSDateFormatter new]; 29 | self.formatter.dateFormat = @"HH : mm"; 30 | } 31 | 32 | return self; 33 | } 34 | 35 | - (void)accessUtcSec { 36 | 37 | // Unix UTC 38 | NSTimeInterval seconds = (self.utcSec <= 0 ? 0 : self.utcSec); 39 | 40 | // 获取到了UTC时间 41 | NSDate *utcDate = [NSDate dateWithTimeIntervalSince1970:seconds]; 42 | 43 | // 设置时间格式 44 | self.timeString = [self.formatter stringFromDate:utcDate]; 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /YoCelsius/SunriseView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SunriseView.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/21. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "Sun.h" 12 | 13 | @interface SunriseView : Sun 14 | 15 | /** 16 | * 显示动画 17 | * 18 | * @param duration 动画时间 19 | */ 20 | - (void)showWithDuration:(CGFloat)duration; 21 | 22 | /** 23 | * 隐藏动画 24 | * 25 | * @param duration 动画时间 26 | */ 27 | - (void)hideWithDuration:(CGFloat)duration; 28 | 29 | /** 30 | * 创建出view(先初始化出view,然后再传图片) 31 | */ 32 | - (void)buildView; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /YoCelsius/SunsetView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SunsetView.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/21. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "Sun.h" 12 | 13 | @interface SunsetView : Sun 14 | 15 | /** 16 | * 显示动画 17 | * 18 | * @param duration 动画时间 19 | */ 20 | - (void)showWithDuration:(CGFloat)duration; 21 | 22 | /** 23 | * 隐藏动画 24 | * 25 | * @param duration 动画时间 26 | */ 27 | - (void)hideWithDuration:(CGFloat)duration; 28 | 29 | /** 30 | * 创建出view(先初始化出view,然后再传图片) 31 | */ 32 | - (void)buildView; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /YoCelsius/Sys.h: -------------------------------------------------------------------------------- 1 | // 2 | // Sys.h 3 | // 4 | // http://home.cnblogs.com/u/YouXianMing 5 | // https://github.com/YouXianMing 6 | // 7 | // Copyright (c) 2015 YouXianMing All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | @interface Sys : NSObject 13 | 14 | @property (nonatomic, strong) NSNumber *message; // System parameter, do not use it 15 | @property (nonatomic, strong) NSString *country; // Country (GB, JP etc.) 16 | @property (nonatomic, strong) NSNumber *sunset; // Sunrise time, unix, UTC 17 | @property (nonatomic, strong) NSNumber *sunrise; // Sunset time, unix, UTC 18 | 19 | - (void)setValue:(id)value forUndefinedKey:(NSString *)key; 20 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary; 21 | 22 | @end 23 | 24 | -------------------------------------------------------------------------------- /YoCelsius/Sys.m: -------------------------------------------------------------------------------- 1 | // 2 | // Sys.m 3 | // 4 | // http://home.cnblogs.com/u/YouXianMing 5 | // https://github.com/YouXianMing 6 | // 7 | // Copyright (c) 2015 YouXianMing All rights reserved. 8 | // 9 | 10 | #import "Sys.h" 11 | 12 | @implementation Sys 13 | 14 | - (void)setValue:(id)value forUndefinedKey:(NSString *)key { 15 | 16 | } 17 | 18 | - (void)setValue:(id)value forKey:(NSString *)key { 19 | 20 | if ([value isKindOfClass:[NSNull class]]) { 21 | 22 | return; 23 | } 24 | 25 | [super setValue:value forKey:key]; 26 | } 27 | 28 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary { 29 | 30 | if ([dictionary isKindOfClass:[NSDictionary class]]) { 31 | 32 | self = [super init]; 33 | 34 | if (self) { 35 | 36 | [self setValuesForKeysWithDictionary:dictionary]; 37 | } 38 | 39 | return self; 40 | 41 | } else { 42 | 43 | return nil; 44 | } 45 | } 46 | 47 | @end -------------------------------------------------------------------------------- /YoCelsius/TapTitleView.h: -------------------------------------------------------------------------------- 1 | // 2 | // TapTitleView.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/3/2. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | @class TapTitleView; 13 | 14 | @protocol TapTitleViewDelegate 15 | 16 | @optional 17 | 18 | - (void)tapTitleView:(TapTitleView *)tapView; 19 | 20 | @end 21 | 22 | @interface TapTitleView : UIView 23 | 24 | @property (nonatomic, weak) id delegate; 25 | 26 | @property (nonatomic, strong) NSString *title; 27 | @property (nonatomic, strong) UIColor *normalColor; 28 | @property (nonatomic, strong) UIColor *tapColor; 29 | @property (nonatomic, strong) UIFont *font; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /YoCelsius/Temp.h: -------------------------------------------------------------------------------- 1 | // 2 | // Temp.h 3 | // 4 | // http://home.cnblogs.com/u/YouXianMing 5 | // https://github.com/YouXianMing 6 | // 7 | // Copyright (c) 2015 YouXianMing All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | @interface Temp : NSObject 13 | 14 | @property (nonatomic, strong) NSNumber *min; // Minimum temperature at the moment. This is deviation from current temp that is possible for large cities and megalopolises geographically expanded (use these parameter optionally) 15 | @property (nonatomic, strong) NSNumber *max; // Maximum temperature at the moment. This is deviation from current temp that is possible for large cities and megalopolises geographically expanded (use these parameter optionally) 16 | 17 | @property (nonatomic, strong) NSNumber *morn; // 早晨 18 | @property (nonatomic, strong) NSNumber *day; // 白天 19 | @property (nonatomic, strong) NSNumber *night; // 下午 20 | @property (nonatomic, strong) NSNumber *eve; // 午夜 21 | 22 | - (void)setValue:(id)value forUndefinedKey:(NSString *)key; 23 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary; 24 | 25 | 26 | @end 27 | 28 | -------------------------------------------------------------------------------- /YoCelsius/Temp.m: -------------------------------------------------------------------------------- 1 | // 2 | // Temp.m 3 | // 4 | // http://home.cnblogs.com/u/YouXianMing 5 | // https://github.com/YouXianMing 6 | // 7 | // Copyright (c) 2015 YouXianMing All rights reserved. 8 | // 9 | 10 | #import "Temp.h" 11 | 12 | @implementation Temp 13 | 14 | - (void)setValue:(id)value forUndefinedKey:(NSString *)key { 15 | 16 | } 17 | 18 | - (void)setValue:(id)value forKey:(NSString *)key { 19 | 20 | if ([value isKindOfClass:[NSNull class]]) { 21 | 22 | return; 23 | } 24 | 25 | [super setValue:value forKey:key]; 26 | } 27 | 28 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary { 29 | 30 | if ([dictionary isKindOfClass:[NSDictionary class]]) { 31 | 32 | self = [super init]; 33 | 34 | if (self) { 35 | 36 | [self setValuesForKeysWithDictionary:dictionary]; 37 | } 38 | 39 | return self; 40 | 41 | } else { 42 | 43 | return nil; 44 | } 45 | } 46 | 47 | @end -------------------------------------------------------------------------------- /YoCelsius/TemperatureCount.h: -------------------------------------------------------------------------------- 1 | // 2 | // TemperatureCount.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/22. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "NumberCount.h" 12 | 13 | @interface TemperatureCount : NumberCount 14 | 15 | - (void)startAnimation; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /YoCelsius/TemperatureCountLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // TemperatureCountLabel.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/22. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | #import "TemperatureCount.h" 13 | 14 | @interface TemperatureCountLabel : UIView 15 | 16 | /** 17 | * 起始值 18 | */ 19 | @property (nonatomic) CGFloat fromValue; 20 | 21 | /** 22 | * 结束值 23 | */ 24 | @property (nonatomic) CGFloat toValue; 25 | 26 | /** 27 | * 动画引擎 28 | */ 29 | @property (nonatomic, strong) TemperatureCount *temperatureCount; 30 | 31 | /** 32 | * 显示用的label 33 | */ 34 | @property (nonatomic, strong) UILabel *countLabel; 35 | 36 | /** 37 | * 显示动画 38 | * 39 | * @param duration 动画时间 40 | */ 41 | - (void)showDuration:(CGFloat)duration; 42 | 43 | /** 44 | * 隐藏动画 45 | * 46 | * @param duration 隐藏时间 47 | */ 48 | - (void)hideDuration:(CGFloat)duration; 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /YoCelsius/TemperatureCountLabel.m: -------------------------------------------------------------------------------- 1 | // 2 | // TemperatureCountLabel.m 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/22. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "TemperatureCountLabel.h" 12 | 13 | @interface TemperatureCountLabel () 14 | 15 | @end 16 | 17 | @implementation TemperatureCountLabel 18 | 19 | - (instancetype)initWithFrame:(CGRect)frame { 20 | 21 | self = [super initWithFrame:frame]; 22 | 23 | if (self) { 24 | 25 | self.countLabel = [[UILabel alloc] initWithFrame:self.bounds]; 26 | self.countLabel.textAlignment = NSTextAlignmentCenter; 27 | [self addSubview:self.countLabel]; 28 | self.countLabel.alpha = 0; 29 | self.countLabel.numberOfLines = 0; 30 | 31 | self.temperatureCount = [TemperatureCount new]; 32 | self.temperatureCount.delegate = self; 33 | } 34 | 35 | return self; 36 | } 37 | 38 | - (void)numberCount:(NumberCount *)numberCount currentSting:(NSAttributedString *)string { 39 | 40 | self.countLabel.attributedText = string; 41 | } 42 | 43 | - (void)showDuration:(CGFloat)duration { 44 | 45 | self.temperatureCount.fromValue = self.fromValue; 46 | self.temperatureCount.toValue = self.toValue; 47 | self.temperatureCount.duration = duration; 48 | 49 | [self.temperatureCount startAnimation]; 50 | 51 | [UIView animateWithDuration:duration animations:^{ 52 | 53 | self.countLabel.alpha = 1.f; 54 | }]; 55 | } 56 | 57 | - (void)hideDuration:(CGFloat)duration { 58 | 59 | [UIView animateWithDuration:duration animations:^{ 60 | 61 | self.countLabel.alpha = 0.f; 62 | }]; 63 | } 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /YoCelsius/TemperatureView.h: -------------------------------------------------------------------------------- 1 | // 2 | // TemperatureView.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/22. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | 13 | @interface TemperatureView : UIView 14 | 15 | /** 16 | * 温度 17 | */ 18 | @property (nonatomic) CGFloat temperature; 19 | 20 | - (void)buildView; 21 | - (void)show; 22 | - (void)hide; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /YoCelsius/ThreeLineView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ThreeLineView.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/18. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | #import 13 | #import "AnimatedLineView.h" 14 | 15 | @interface ThreeLineView : UIView 16 | 17 | /** 18 | * 显示出来 19 | * 20 | * @param duration 动画持续时间 21 | * @param animated 是否执行动画 22 | */ 23 | - (void)showWithDuration:(CGFloat)duration animated:(BOOL)animated; 24 | 25 | /** 26 | * 隐藏 27 | * 28 | * @param duration 动画持续时间 29 | * @param animated 是否执行动画 30 | */ 31 | - (void)hideWithDuration:(CGFloat)duration animated:(BOOL)animated; 32 | 33 | /** 34 | * 风的速度 35 | */ 36 | @property (nonatomic) CGFloat circleByOneSecond; // 这个值必须给出 37 | 38 | /** 39 | * 一秒钟旋转几圈 40 | * 41 | * @param circleByOneSecond 一秒钟旋转几圈 42 | */ 43 | - (void)rotateImageViewWithCircleByOneSecond; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /YoCelsius/TitleMoveLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // TitleMoveLabel.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/24. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | 13 | #define TITLE_MOVE_LABEL_SHOW_DURATION 1.75 14 | #define TITLE_MOVE_LABEL_HIDE_DURATION 0.75 15 | 16 | @interface TitleMoveLabel : UIView 17 | 18 | @property (nonatomic, strong) UIFont *font; 19 | @property (nonatomic, strong) NSString *text; 20 | @property (nonatomic, strong) UIColor *textColor; 21 | 22 | // 移动距离 23 | @property (nonatomic) CGFloat moveGap; 24 | 25 | // 创建出view 26 | - (void)buildView; 27 | - (void)show; 28 | - (void)hide; 29 | 30 | // 初始化 31 | + (TitleMoveLabel *)withText:(NSString *)text; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /YoCelsius/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIActivityIndicatorView+AFNetworking.h 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import 23 | 24 | #import 25 | 26 | #if TARGET_OS_IOS || TARGET_OS_TV 27 | 28 | #import 29 | 30 | /** 31 | This category adds methods to the UIKit framework's `UIActivityIndicatorView` class. The methods in this category provide support for automatically starting and stopping animation depending on the loading state of a session task. 32 | */ 33 | @interface UIActivityIndicatorView (AFNetworking) 34 | 35 | ///---------------------------------- 36 | /// @name Animating for Session Tasks 37 | ///---------------------------------- 38 | 39 | /** 40 | Binds the animating state to the state of the specified task. 41 | 42 | @param task The task. If `nil`, automatic updating from any previously specified operation will be disabled. 43 | */ 44 | - (void)setAnimatingWithStateOfTask:(nullable NSURLSessionTask *)task; 45 | 46 | @end 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /YoCelsius/UIKit+AFNetworking/UIImage+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+AFNetworking.h 3 | // 4 | // 5 | // Created by Paulo Ferreira on 08/07/15. 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | #if TARGET_OS_IOS || TARGET_OS_TV 26 | 27 | #import 28 | 29 | @interface UIImage (AFNetworking) 30 | 31 | + (UIImage*) safeImageWithData:(NSData*)data; 32 | 33 | @end 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /YoCelsius/UIKit+AFNetworking/UIKit+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIKit+AFNetworking.h 2 | // 3 | // Copyright (c) 2013 AFNetworking (http://afnetworking.com/) 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 | 23 | #if TARGET_OS_IOS || TARGET_OS_TV 24 | #import 25 | 26 | #ifndef _UIKIT_AFNETWORKING_ 27 | #define _UIKIT_AFNETWORKING_ 28 | 29 | #if TARGET_OS_IOS 30 | #import "AFAutoPurgingImageCache.h" 31 | #import "AFImageDownloader.h" 32 | #import "AFNetworkActivityIndicatorManager.h" 33 | #import "UIRefreshControl+AFNetworking.h" 34 | #import "UIWebView+AFNetworking.h" 35 | #endif 36 | 37 | #import "UIActivityIndicatorView+AFNetworking.h" 38 | #import "UIButton+AFNetworking.h" 39 | #import "UIImageView+AFNetworking.h" 40 | #import "UIProgressView+AFNetworking.h" 41 | #endif /* _UIKIT_AFNETWORKING_ */ 42 | #endif 43 | -------------------------------------------------------------------------------- /YoCelsius/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIRefreshControl+AFNetworking.m 2 | // 3 | // Copyright (c) 2014 AFNetworking (http://afnetworking.com) 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 | 23 | #import 24 | 25 | #import 26 | 27 | #if TARGET_OS_IOS 28 | 29 | #import 30 | 31 | NS_ASSUME_NONNULL_BEGIN 32 | 33 | /** 34 | This category adds methods to the UIKit framework's `UIRefreshControl` class. The methods in this category provide support for automatically beginning and ending refreshing depending on the loading state of a session task. 35 | */ 36 | @interface UIRefreshControl (AFNetworking) 37 | 38 | ///----------------------------------- 39 | /// @name Refreshing for Session Tasks 40 | ///----------------------------------- 41 | 42 | /** 43 | Binds the refreshing state to the state of the specified task. 44 | 45 | @param task The task. If `nil`, automatic updating from any previously specified operation will be disabled. 46 | */ 47 | - (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task; 48 | 49 | @end 50 | 51 | NS_ASSUME_NONNULL_END 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /YoCelsius/UILabel+Temperature.h: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+Temperature.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/21. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | 13 | @interface UILabel (Temperature) 14 | 15 | /** 16 | * frame值为(0, 0, 45, 100) 17 | * 18 | * @param text 文本 19 | * @param tag 该label的tag值 20 | * 21 | * @return 该label 22 | */ 23 | + (UILabel *)labelWithNumberText:(NSString *)text tag:(int)tag; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /YoCelsius/UILabel+Temperature.m: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+Temperature.m 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/21. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "UILabel+Temperature.h" 12 | 13 | @implementation UILabel (Temperature) 14 | 15 | + (UILabel *)labelWithNumberText:(NSString *)text tag:(int)tag { 16 | 17 | UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 45, 100)]; 18 | label.text = text; 19 | label.tag = tag; 20 | label.textAlignment = NSTextAlignmentCenter; 21 | label.textColor = COLOR_PURE_; 22 | label.font = [UIFont fontWithName:LATO_THIN size:75.f]; 23 | 24 | return label; 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /YoCelsius/UIView+DebugFrame.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+DebugFrame.h 3 | // ConverView 4 | // 5 | // Created by YouXianMing on 2017/7/26. 6 | // Copyright © 2017年 TechCode. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIView (DebugFrame) 12 | 13 | /** 14 | 显示指定颜色的外边框 15 | 16 | @param color 颜色 17 | */ 18 | - (void)showOutlineWithColor:(UIColor *)color; 19 | 20 | /** 21 | 显示指定颜色的外边框(粗) 22 | 23 | @param color 颜色 24 | */ 25 | - (void)showBoldOutlineWithColor:(UIColor *)color; 26 | 27 | /** 28 | 显示随机颜色的外边框 29 | */ 30 | - (void)showRandomColorOutline; 31 | 32 | /** 33 | 显示随机颜色的外边框(粗) 34 | */ 35 | - (void)showRandomBoldColorOutline; 36 | 37 | /** 38 | 显示随机颜色的外边框与背景色 39 | */ 40 | - (void)showRandomColorOutlineAndBackgroundColor; 41 | 42 | /** 43 | 显示随机颜色的外边框与背景色(粗) 44 | */ 45 | - (void)showRandomBoldColorOutlineAndBackgroundColor; 46 | 47 | - (void)subviewsShowOutlineWithColor:(UIColor *)color level:(NSInteger)level; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /YoCelsius/UIView+GlowView.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+GlowView.h 3 | // YouXianClock 4 | // 5 | // Created by YouXianMing on 14-10-15. 6 | // Copyright (c) 2014年 YouXianMing. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIView (GlowView) 12 | 13 | @property (nonatomic, strong) NSNumber *GCDTimerInterval; // 定时器的时间间隔,给float值 14 | @property (nonatomic, strong) NSNumber *glowDuration; // layer动画的时间长度,给float值 15 | @property (nonatomic, strong) NSNumber *glowLayerOpacity; // 设置glowLayer的动画透明度的程度,给float值,范围在[0,1] 16 | 17 | - (void)createGlowLayerWithColor:(UIColor *)color glowRadius:(CGFloat)radius; 18 | - (void)startGlow; 19 | - (void)glowToGlowLayerOnce; 20 | - (void)glowToNormalLayerOnce; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /YoCelsius/UIView+SetRect.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+SetRect.h 3 | // UIView 4 | // 5 | // Created by YouXianMing on 16/1/29. 6 | // Copyright © 2016年 YouXianMing. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #define Width [UIScreen mainScreen].bounds.size.width 12 | #define Height [UIScreen mainScreen].bounds.size.height 13 | #define Screen_Size_Small (Width == 320.f) 14 | #define Screen_Size_Middle (Width == 375.f) 15 | #define Screen_Size_Big (Width == 414.f) 16 | 17 | @interface UIView (SetRect) 18 | 19 | /*---------------------- 20 | * Absolute coordinate * 21 | ----------------------*/ 22 | 23 | @property (nonatomic) CGPoint viewOrigin; 24 | @property (nonatomic) CGSize viewSize; 25 | 26 | @property (nonatomic) CGFloat x; 27 | @property (nonatomic) CGFloat y; 28 | @property (nonatomic) CGFloat width; 29 | @property (nonatomic) CGFloat height; 30 | 31 | @property (nonatomic) CGFloat top; 32 | @property (nonatomic) CGFloat bottom; 33 | @property (nonatomic) CGFloat left; 34 | @property (nonatomic) CGFloat right; 35 | 36 | @property (nonatomic) CGFloat centerX; 37 | @property (nonatomic) CGFloat centerY; 38 | 39 | /*---------------------- 40 | * Relative coordinate * 41 | ----------------------*/ 42 | 43 | @property (nonatomic, readonly) CGFloat middleX; 44 | @property (nonatomic, readonly) CGFloat middleY; 45 | @property (nonatomic, readonly) CGPoint middlePoint; 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /YoCelsius/UpToDownView.h: -------------------------------------------------------------------------------- 1 | // 2 | // UpToDownView.h 3 | // AnimatedLineView 4 | // 5 | // Created by XianMingYou on 15/3/4. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "LineAnimationView.h" 12 | 13 | @interface UpToDownView : LineAnimationView 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /YoCelsius/UpToDownView.m: -------------------------------------------------------------------------------- 1 | // 2 | // UpToDownView.m 3 | // AnimatedLineView 4 | // 5 | // Created by XianMingYou on 15/3/4. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "UpToDownView.h" 12 | 13 | @implementation UpToDownView 14 | 15 | - (instancetype)initWithFrame:(CGRect)frame { 16 | 17 | self = [super initWithFrame:frame]; 18 | 19 | if (self) { 20 | 21 | CGFloat x = frame.origin.x; 22 | CGFloat y = frame.origin.y; 23 | CGFloat height = frame.size.height; 24 | CGFloat width = frame.size.width; 25 | 26 | self.startFrame = CGRectMake(x, y, width, 0); 27 | self.midFrame = CGRectMake(x, y, width, height); 28 | self.endFrame = CGRectMake(x, y + height, width, 0); 29 | 30 | self.frame = self.startFrame; 31 | } 32 | 33 | return self; 34 | } 35 | 36 | - (void)show { 37 | 38 | // 动画 39 | [UIView animateWithDuration:self.fadeToShowDuration animations:^{ 40 | 41 | self.alpha = self.maxAlpha; 42 | self.frame = self.midFrame; 43 | }]; 44 | } 45 | 46 | - (void)hide { 47 | 48 | // 动画 49 | [UIView animateWithDuration:self.fadeToHideDuration animations:^{ 50 | 51 | self.alpha = 0.f; 52 | self.frame = self.endFrame; 53 | 54 | } completion:^(BOOL finished) { 55 | 56 | self.frame = self.startFrame; 57 | self.alpha = 0.f; 58 | }]; 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /YoCelsius/UpdatingView.h: -------------------------------------------------------------------------------- 1 | // 2 | // UpdatingView.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/28. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | #import "SnowView.h" 13 | #import "UIView+GlowView.h" 14 | #import "UIView+SetRect.h" 15 | #import "CALayer+MaskLayer.h" 16 | 17 | @interface UpdatingView : UIView 18 | 19 | - (void)insertIntoView:(UIView *)view; 20 | 21 | - (void)show; 22 | - (void)hide; 23 | - (void)showFailed; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /YoCelsius/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/15. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | 13 | @interface WeatherInfoController : UIViewController 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /YoCelsius/Weather&Time.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/Weather&Time.ttf -------------------------------------------------------------------------------- /YoCelsius/Weather.m: -------------------------------------------------------------------------------- 1 | // 2 | // Weather.m 3 | // 4 | // http://home.cnblogs.com/u/YouXianMing 5 | // https://github.com/YouXianMing 6 | // 7 | // Copyright (c) 2015 YouXianMing All rights reserved. 8 | // 9 | 10 | #import "Weather.h" 11 | 12 | @implementation Weather 13 | 14 | - (void)setValue:(id)value forUndefinedKey:(NSString *)key { 15 | 16 | if([key isEqualToString:@"id"]) { 17 | 18 | self.weatherId = value; 19 | return; 20 | } 21 | 22 | if ([key isEqualToString:@"description"]) { 23 | 24 | self.descriptionInfo = value; 25 | return; 26 | } 27 | } 28 | 29 | - (void)setValue:(id)value forKey:(NSString *)key { 30 | 31 | if ([value isKindOfClass:[NSNull class]]) { 32 | 33 | return; 34 | } 35 | 36 | [super setValue:value forKey:key]; 37 | } 38 | 39 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary { 40 | 41 | if ([dictionary isKindOfClass:[NSDictionary class]]) { 42 | 43 | self = [super init]; 44 | 45 | if (self) { 46 | 47 | [self setValuesForKeysWithDictionary:dictionary]; 48 | } 49 | 50 | return self; 51 | 52 | } else { 53 | 54 | return nil; 55 | } 56 | } 57 | 58 | @end -------------------------------------------------------------------------------- /YoCelsius/WeatherIconView.h: -------------------------------------------------------------------------------- 1 | // 2 | // WeatherIconView.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/24. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | 13 | @interface WeatherIconView : UIView 14 | 15 | /** 16 | * 天气文本 17 | */ 18 | @property (nonatomic, strong) NSNumber *weatherNumber; 19 | 20 | /** 21 | * 创建出view 22 | */ 23 | - (void)buildView; 24 | 25 | /** 26 | * 显示 27 | */ 28 | - (void)show; 29 | 30 | /** 31 | * 隐藏 32 | */ 33 | - (void)hide; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /YoCelsius/WeatherInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // WeatherInfo.h 3 | // 4 | // http://home.cnblogs.com/u/YouXianMing 5 | // https://github.com/YouXianMing 6 | // 7 | // Copyright (c) 2015 YouXianMing All rights reserved. 8 | // 9 | 10 | #import 11 | #import "Temp.h" 12 | #import "Weather.h" 13 | 14 | @interface WeatherInfo : NSObject 15 | 16 | @property (nonatomic, strong) NSArray *weather; // Weather信息列表 17 | @property (nonatomic, strong) Temp *temp; // Temperature, Kelvin (subtract 273.15 to convert to Celsius) 18 | 19 | @property (nonatomic, strong) NSNumber *clouds; // Cloudiness, % 20 | @property (nonatomic, strong) NSNumber *humidity; // Humidity, % 21 | @property (nonatomic, strong) NSNumber *dt; // Data receiving time, unix time, GMT 22 | @property (nonatomic, strong) NSNumber *speed; // Wind speed, mps 23 | @property (nonatomic, strong) NSNumber *pressure; // Atmospheric pressure (on the sea level, if there is no sea_level or grnd_level data), hPa 24 | @property (nonatomic, strong) NSNumber *deg; // Wind direction, degrees (meteorological) 25 | 26 | - (void)setValue:(id)value forUndefinedKey:(NSString *)key; 27 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary; 28 | 29 | @end 30 | 31 | -------------------------------------------------------------------------------- /YoCelsius/WeatherInfo.m: -------------------------------------------------------------------------------- 1 | // 2 | // WeatherInfo.m 3 | // 4 | // http://home.cnblogs.com/u/YouXianMing 5 | // https://github.com/YouXianMing 6 | // 7 | // Copyright (c) 2015 YouXianMing All rights reserved. 8 | // 9 | 10 | #import "WeatherInfo.h" 11 | 12 | @implementation WeatherInfo 13 | 14 | - (void)setValue:(id)value forUndefinedKey:(NSString *)key { 15 | 16 | } 17 | 18 | - (void)setValue:(id)value forKey:(NSString *)key { 19 | 20 | if ([value isKindOfClass:[NSNull class]]) { 21 | 22 | return; 23 | } 24 | 25 | if ([key isEqualToString:@"temp"]) { 26 | 27 | value = [[Temp alloc] initWithDictionary:value]; 28 | } 29 | 30 | if ([key isEqualToString:@"weather"] && [value isKindOfClass:[NSArray class]]) { 31 | 32 | NSArray *tmp = value; 33 | NSMutableArray *weatherList = [NSMutableArray array]; 34 | 35 | for (NSDictionary *data in tmp) { 36 | 37 | Weather *weather = [[Weather alloc] initWithDictionary:data]; 38 | [weatherList addObject:weather]; 39 | } 40 | 41 | value = weatherList; 42 | } 43 | 44 | [super setValue:value forKey:key]; 45 | } 46 | 47 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary { 48 | 49 | if ([dictionary isKindOfClass:[NSDictionary class]]) { 50 | 51 | self = [super init]; 52 | 53 | if (self) { 54 | 55 | [self setValuesForKeysWithDictionary:dictionary]; 56 | } 57 | 58 | return self; 59 | 60 | } else { 61 | 62 | return nil; 63 | } 64 | } 65 | 66 | @end -------------------------------------------------------------------------------- /YoCelsius/WeatherInfoController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/15. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | 13 | @interface WeatherInfoController : UIViewController 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /YoCelsius/WeatherNumberMeaningTransform.h: -------------------------------------------------------------------------------- 1 | // 2 | // WeatherNumberMeaningTransform.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/3/4. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | #import "EmitterLayerView.h" 13 | 14 | @interface WeatherNumberMeaningTransform : NSObject 15 | 16 | + (NSString *)fontTextWeatherNumber:(NSNumber *)number; 17 | + (UIColor *)iconColor:(NSNumber *)number; 18 | + (EMitterType)emitterTypeWithNumber:(NSNumber *)number; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /YoCelsius/WeatherTitleView.h: -------------------------------------------------------------------------------- 1 | // 2 | // WeatherTitleView.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/23. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | 13 | @interface WeatherTitleView : UIView 14 | 15 | /** 16 | * 城市名字 17 | */ 18 | @property (nonatomic, strong) NSString *cityName; 19 | 20 | /** 21 | * 天气描述信息 22 | */ 23 | @property (nonatomic, strong) NSString *weatherDescription; 24 | 25 | /** 26 | * 天气更新时间 27 | */ 28 | @property (nonatomic, strong) NSString *weatherUpdateTime; 29 | 30 | /** 31 | * 创建出view 32 | */ 33 | - (void)buildView; 34 | 35 | /** 36 | * 显示出view 37 | */ 38 | - (void)show; 39 | 40 | /** 41 | * 隐藏view 42 | */ 43 | - (void)hide; 44 | 45 | /** 46 | * 处理偏移量数据 47 | * 48 | * @param offsetValue 偏移量 49 | */ 50 | - (void)accessOffsetValue:(CGFloat)offsetValue; 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /YoCelsius/WeatherView.h: -------------------------------------------------------------------------------- 1 | // 2 | // WeatherView.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/23. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | #import "CurrentWeatherData.h" 13 | #import "CurrentConditions.h" 14 | 15 | @protocol WeatherViewDelegate 16 | 17 | - (void)pullUpEventWithData:(CurrentConditions *)condition; 18 | - (void)pullDownToRefreshData; 19 | 20 | @end 21 | 22 | @interface WeatherView : UIView 23 | 24 | /** 25 | * 代理 26 | */ 27 | @property (nonatomic, weak) id delegate; 28 | 29 | /** 30 | * 天气的数据 31 | */ 32 | @property (nonatomic, strong) CurrentWeatherData *weahterData; 33 | @property (nonatomic, strong) CurrentConditions *weatherConditions; 34 | 35 | /** 36 | * 显示动画 37 | */ 38 | - (void)show; 39 | 40 | /** 41 | * 隐藏动画 42 | */ 43 | - (void)hide; 44 | 45 | /** 46 | * 创建出view 47 | */ 48 | - (void)buildView; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /YoCelsius/Wind.h: -------------------------------------------------------------------------------- 1 | // 2 | // Wind.h 3 | // 4 | // http://home.cnblogs.com/u/YouXianMing 5 | // https://github.com/YouXianMing 6 | // 7 | // Copyright (c) 2015 YouXianMing All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | @interface Wind : NSObject 13 | 14 | @property (nonatomic, strong) NSNumber *speed; // Wind speed, mps 15 | @property (nonatomic, strong) NSNumber *deg; // Wind direction, degrees (meteorological) 16 | 17 | - (void)setValue:(id)value forUndefinedKey:(NSString *)key; 18 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary; 19 | 20 | @end 21 | 22 | -------------------------------------------------------------------------------- /YoCelsius/Wind.m: -------------------------------------------------------------------------------- 1 | // 2 | // Wind.m 3 | // 4 | // http://home.cnblogs.com/u/YouXianMing 5 | // https://github.com/YouXianMing 6 | // 7 | // Copyright (c) 2015 YouXianMing All rights reserved. 8 | // 9 | 10 | #import "Wind.h" 11 | 12 | @implementation Wind 13 | 14 | - (void)setValue:(id)value forUndefinedKey:(NSString *)key { 15 | 16 | } 17 | 18 | - (void)setValue:(id)value forKey:(NSString *)key { 19 | 20 | if ([value isKindOfClass:[NSNull class]]) { 21 | 22 | return; 23 | } 24 | 25 | [super setValue:value forKey:key]; 26 | } 27 | 28 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary { 29 | 30 | if ([dictionary isKindOfClass:[NSDictionary class]]) { 31 | 32 | self = [super init]; 33 | 34 | if (self) { 35 | 36 | [self setValuesForKeysWithDictionary:dictionary]; 37 | } 38 | 39 | return self; 40 | 41 | } else { 42 | 43 | return nil; 44 | } 45 | } 46 | 47 | @end -------------------------------------------------------------------------------- /YoCelsius/WindSpeedCount.h: -------------------------------------------------------------------------------- 1 | // 2 | // WindSpeedCount.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/19. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "NumberCount.h" 12 | 13 | @interface WindSpeedCount : NumberCount 14 | 15 | - (void)startAnimation; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /YoCelsius/WindSpeedCountLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // WindSpeedCountLabel.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/19. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | #import "WindSpeedCount.h" 13 | 14 | @interface WindSpeedCountLabel : UIView 15 | 16 | /** 17 | * 起始值 18 | */ 19 | @property (nonatomic) CGFloat fromValue; 20 | 21 | /** 22 | * 结束值 23 | */ 24 | @property (nonatomic) CGFloat toValue; 25 | 26 | /** 27 | * 动画引擎 28 | */ 29 | @property (nonatomic, strong) WindSpeedCount *windSpeedCount; 30 | 31 | /** 32 | * 显示用的label 33 | */ 34 | @property (nonatomic, strong) UILabel *countLabel; 35 | 36 | /** 37 | * 显示动画 38 | * 39 | * @param duration 动画时间 40 | */ 41 | - (void)showDuration:(CGFloat)duration; 42 | 43 | /** 44 | * 隐藏动画 45 | * 46 | * @param duration 隐藏时间 47 | */ 48 | - (void)hideDuration:(CGFloat)duration; 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /YoCelsius/WindSpeedCountLabel.m: -------------------------------------------------------------------------------- 1 | // 2 | // WindSpeedCountLabel.m 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/19. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import "WindSpeedCountLabel.h" 12 | 13 | @interface WindSpeedCountLabel () 14 | 15 | @end 16 | 17 | @implementation WindSpeedCountLabel 18 | 19 | - (instancetype)initWithFrame:(CGRect)frame { 20 | 21 | self = [super initWithFrame:frame]; 22 | 23 | if (self) { 24 | 25 | self.countLabel = [[UILabel alloc] initWithFrame:self.bounds]; 26 | self.countLabel.textAlignment = NSTextAlignmentRight; 27 | [self addSubview:self.countLabel]; 28 | self.countLabel.alpha = 0; 29 | 30 | self.windSpeedCount = [WindSpeedCount new]; 31 | self.windSpeedCount.delegate = self; 32 | } 33 | 34 | return self; 35 | } 36 | 37 | - (void)numberCount:(NumberCount *)numberCount currentSting:(NSAttributedString *)string { 38 | 39 | self.countLabel.attributedText = string; 40 | } 41 | 42 | - (void)showDuration:(CGFloat)duration { 43 | 44 | self.windSpeedCount.fromValue = self.fromValue; 45 | self.windSpeedCount.toValue = self.toValue; 46 | self.windSpeedCount.duration = duration; 47 | 48 | [self.windSpeedCount startAnimation]; 49 | 50 | [UIView animateWithDuration:duration animations:^{ 51 | 52 | self.countLabel.alpha = 1.f; 53 | }]; 54 | } 55 | 56 | - (void)hideDuration:(CGFloat)duration { 57 | 58 | self.windSpeedCount.fromValue = self.toValue; 59 | self.windSpeedCount.toValue = 0; 60 | self.windSpeedCount.duration = duration; 61 | 62 | [self.windSpeedCount startAnimation]; 63 | 64 | [UIView animateWithDuration:duration animations:^{ 65 | 66 | self.countLabel.alpha = 0.f; 67 | }]; 68 | } 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /YoCelsius/WindSpeedView.h: -------------------------------------------------------------------------------- 1 | // 2 | // WindSpeedView.h 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/19. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | 13 | @interface WindSpeedView : UIView 14 | 15 | /** 16 | * 一秒钟旋转几圈 17 | */ 18 | @property (nonatomic) CGFloat circleByOneSecond; 19 | 20 | /** 21 | * 风的速度 22 | */ 23 | @property (nonatomic) CGFloat windSpeed; 24 | 25 | /** 26 | * 创建出view 27 | */ 28 | - (void)buildView; 29 | 30 | /** 31 | * 显示 32 | */ 33 | - (void)show; 34 | 35 | /** 36 | * 隐藏 37 | */ 38 | - (void)hide; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /YoCelsius/YXGCD/GCD.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCD.h 3 | // GCD 4 | // 5 | // http://home.cnblogs.com/u/YouXianMing/ 6 | // https://github.com/YouXianMing 7 | // 8 | // Created by XianMingYou on 15/3/15. 9 | // Copyright (c) 2015年 XianMingYou. All rights reserved. 10 | // 11 | 12 | #import "GCDQueue.h" 13 | #import "GCDGroup.h" 14 | #import "GCDSemaphore.h" 15 | #import "GCDTimer.h" 16 | 17 | 18 | -------------------------------------------------------------------------------- /YoCelsius/YXGCD/GCDGroup.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDGroup.h 3 | // GCD 4 | // 5 | // http://home.cnblogs.com/u/YouXianMing/ 6 | // https://github.com/YouXianMing 7 | // 8 | // Created by XianMingYou on 15/3/15. 9 | // Copyright (c) 2015年 XianMingYou. All rights reserved. 10 | // 11 | 12 | #import 13 | 14 | @interface GCDGroup : NSObject 15 | 16 | @property (strong, nonatomic, readonly) dispatch_group_t dispatchGroup; 17 | 18 | #pragma 初始化 19 | - (instancetype)init; 20 | 21 | #pragma mark - 用法 22 | - (void)enter; 23 | - (void)leave; 24 | - (void)wait; 25 | - (BOOL)wait:(int64_t)delta; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /YoCelsius/YXGCD/GCDGroup.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDGroup.m 3 | // GCD 4 | // 5 | // http://home.cnblogs.com/u/YouXianMing/ 6 | // https://github.com/YouXianMing 7 | // 8 | // Created by XianMingYou on 15/3/15. 9 | // Copyright (c) 2015年 XianMingYou. All rights reserved. 10 | // 11 | 12 | #import "GCDGroup.h" 13 | 14 | @interface GCDGroup () 15 | 16 | @property (strong, nonatomic, readwrite) dispatch_group_t dispatchGroup; 17 | 18 | @end 19 | 20 | @implementation GCDGroup 21 | 22 | - (instancetype)init { 23 | 24 | self = [super init]; 25 | 26 | if (self) { 27 | 28 | self.dispatchGroup = dispatch_group_create(); 29 | } 30 | 31 | return self; 32 | } 33 | 34 | - (void)enter { 35 | 36 | dispatch_group_enter(self.dispatchGroup); 37 | } 38 | 39 | - (void)leave { 40 | 41 | dispatch_group_leave(self.dispatchGroup); 42 | } 43 | 44 | - (void)wait { 45 | 46 | dispatch_group_wait(self.dispatchGroup, DISPATCH_TIME_FOREVER); 47 | } 48 | 49 | - (BOOL)wait:(int64_t)delta { 50 | 51 | return dispatch_group_wait(self.dispatchGroup, dispatch_time(DISPATCH_TIME_NOW, delta)) == 0; 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /YoCelsius/YXGCD/GCDSemaphore.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDSemaphore.h 3 | // GCD 4 | // 5 | // http://home.cnblogs.com/u/YouXianMing/ 6 | // https://github.com/YouXianMing 7 | // 8 | // Created by XianMingYou on 15/3/15. 9 | // Copyright (c) 2015年 XianMingYou. All rights reserved. 10 | // 11 | 12 | #import 13 | 14 | @interface GCDSemaphore : NSObject 15 | 16 | @property (strong, readonly, nonatomic) dispatch_semaphore_t dispatchSemaphore; 17 | 18 | #pragma 初始化 19 | - (instancetype)init; 20 | - (instancetype)initWithValue:(long)value; 21 | 22 | #pragma mark - 用法 23 | - (BOOL)signal; 24 | - (void)wait; 25 | - (BOOL)wait:(int64_t)delta; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /YoCelsius/YXGCD/GCDSemaphore.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDSemaphore.m 3 | // GCD 4 | // 5 | // http://home.cnblogs.com/u/YouXianMing/ 6 | // https://github.com/YouXianMing 7 | // 8 | // Created by XianMingYou on 15/3/15. 9 | // Copyright (c) 2015年 XianMingYou. All rights reserved. 10 | // 11 | 12 | #import "GCDSemaphore.h" 13 | 14 | @interface GCDSemaphore () 15 | 16 | @property (strong, readwrite, nonatomic) dispatch_semaphore_t dispatchSemaphore; 17 | 18 | @end 19 | 20 | @implementation GCDSemaphore 21 | 22 | - (instancetype)init { 23 | 24 | self = [super init]; 25 | 26 | if (self) { 27 | 28 | self.dispatchSemaphore = dispatch_semaphore_create(0); 29 | } 30 | 31 | return self; 32 | } 33 | 34 | - (instancetype)initWithValue:(long)value { 35 | 36 | self = [super init]; 37 | 38 | if (self) { 39 | 40 | self.dispatchSemaphore = dispatch_semaphore_create(value); 41 | } 42 | 43 | return self; 44 | } 45 | 46 | - (BOOL)signal { 47 | 48 | return dispatch_semaphore_signal(self.dispatchSemaphore) != 0; 49 | } 50 | 51 | - (void)wait { 52 | 53 | dispatch_semaphore_wait(self.dispatchSemaphore, DISPATCH_TIME_FOREVER); 54 | } 55 | 56 | - (BOOL)wait:(int64_t)delta { 57 | 58 | return dispatch_semaphore_wait(self.dispatchSemaphore, dispatch_time(DISPATCH_TIME_NOW, delta)) == 0; 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /YoCelsius/YXGCD/GCDTimer.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDTimer.h 3 | // GCD 4 | // 5 | // http://home.cnblogs.com/u/YouXianMing/ 6 | // https://github.com/YouXianMing 7 | // 8 | // Created by XianMingYou on 15/3/15. 9 | // Copyright (c) 2015年 XianMingYou. All rights reserved. 10 | // 11 | 12 | #import 13 | 14 | @class GCDQueue; 15 | 16 | @interface GCDTimer : NSObject 17 | 18 | @property (strong, readonly, nonatomic) dispatch_source_t dispatchSource; 19 | 20 | #pragma 初始化 21 | - (instancetype)init; 22 | - (instancetype)initInQueue:(GCDQueue *)queue; 23 | 24 | #pragma mark - 用法 25 | - (void)event:(dispatch_block_t)block timeInterval:(uint64_t)interval; 26 | - (void)event:(dispatch_block_t)block timeInterval:(uint64_t)interval delay:(uint64_t)delay; 27 | - (void)event:(dispatch_block_t)block timeIntervalWithSecs:(float)secs; 28 | - (void)event:(dispatch_block_t)block timeIntervalWithSecs:(float)secs delaySecs:(float)delaySecs; 29 | - (void)start; 30 | - (void)destroy; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /YoCelsius/YoCelsius-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YouXianMing/YoCelsius/e78c438579ede49005547c18a522bead2c99a429/YoCelsius/YoCelsius-bg.png -------------------------------------------------------------------------------- /YoCelsius/YoCelsius.pch: -------------------------------------------------------------------------------- 1 | // 2 | // PrefixHeader.pch 3 | // TestPch 4 | // 5 | // Created by YouXianMing on 14-9-26. 6 | // Copyright (c) 2014年 YouXianMing. All rights reserved. 7 | // 8 | 9 | #ifndef AFNetworking_PCH 10 | #define AFNetworking_PCH 11 | 12 | /*------------------------------------------- 13 | * $(SRCROOT)/$(PROJECT_NAME)/YoCelsius.pch * 14 | -------------------------------------------*/ 15 | 16 | #import 17 | 18 | #ifndef __IPHONE_4_0 19 | #warning "This project uses features only available in iOS SDK 4.0 and later." 20 | #endif 21 | 22 | #ifdef __OBJC__ 23 | #import 24 | #import 25 | #import "Networking.h" 26 | #import "AppColor.h" 27 | #import "UIView+SetRect.h" 28 | #import "UIView+DebugFrame.h" 29 | #import "FontInfomation.h" 30 | #import "AddedFont.h" 31 | #import "GCD.h" 32 | #import "YXEasing.h" 33 | #import "POP.h" 34 | #import "NSString+File.h" 35 | #import "DeviceInfo.h" 36 | #endif 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /YoCelsius/YoCelsiusNetworkingInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // YoCelsiusNetworkingInfo.h 3 | // YoCelsius 4 | // 5 | // Created by YouXianMing on 2017/11/13. 6 | // Copyright © 2017年 XianMingYou. All rights reserved. 7 | // 8 | 9 | #import "NetworkingInfo.h" 10 | 11 | @interface YoCelsiusNetworkingInfo : NetworkingInfo 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YoCelsius/YoCelsiusNetworkingInfo.m: -------------------------------------------------------------------------------- 1 | // 2 | // YoCelsiusNetworkingInfo.m 3 | // YoCelsius 4 | // 5 | // Created by YouXianMing on 2017/11/13. 6 | // Copyright © 2017年 XianMingYou. All rights reserved. 7 | // 8 | 9 | #import "YoCelsiusNetworkingInfo.h" 10 | 11 | @implementation YoCelsiusNetworkingInfo 12 | 13 | - (void)showMessage { 14 | 15 | NSString *method = nil; 16 | switch (self.networking.method) { 17 | 18 | case kNetworkingGET: 19 | method = @"GET"; 20 | break; 21 | 22 | case kNetworkingPOST: 23 | method = @"POST"; 24 | break; 25 | 26 | case kNetworkingUPLOAD: 27 | method = @"UPLOAD"; 28 | break; 29 | 30 | default: 31 | break; 32 | } 33 | 34 | NSMutableString *string = [NSMutableString string]; 35 | 36 | [string appendString:@"\n\n-------------------------------------------------------------------------\n"]; 37 | 38 | if (self.networking.serviceInfo) { 39 | 40 | [string appendFormat:@"服务描述: %@\n\n", self.networking.serviceInfo]; 41 | } 42 | 43 | [string appendFormat:@"服务地址: [%@] %@\n\n", method, self.networking.urlString]; 44 | 45 | if (self.networking.responseSerializer.acceptableContentTypes.allObjects.count) { 46 | 47 | [string appendFormat:@"Response ContentTypes: %@\n\n", self.networking.responseSerializer.acceptableContentTypes]; 48 | } 49 | 50 | if (self.networking.HTTPHeaderFieldsWithValues.allKeys.count) { 51 | 52 | [string appendFormat:@"头部信息: \n%@\n", self.networking.HTTPHeaderFieldsWithValues]; 53 | } 54 | 55 | if (self.networking.requestParameter) { 56 | 57 | [string appendFormat:@"参数列表: \n%@\n", self.networking.requestParameter]; 58 | } 59 | 60 | [string appendString:@"-------------------------------------------------------------------------\n"]; 61 | 62 | NSLog(@"%@", string); 63 | } 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /YoCelsius/YoCelsiusRequestParameterSerializer.h: -------------------------------------------------------------------------------- 1 | // 2 | // YoCelsiusRequestParameterSerializer.h 3 | // YoCelsius 4 | // 5 | // Created by YouXianMing on 2017/11/8. 6 | // Copyright © 2017年 XianMingYou. All rights reserved. 7 | // 8 | 9 | #import "RequestParameterSerializer.h" 10 | 11 | @interface YoCelsiusRequestParameterSerializer : RequestParameterSerializer 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YoCelsius/YoCelsiusRequestParameterSerializer.m: -------------------------------------------------------------------------------- 1 | // 2 | // YoCelsiusRequestParameterSerializer.m 3 | // YoCelsius 4 | // 5 | // Created by YouXianMing on 2017/11/8. 6 | // Copyright © 2017年 XianMingYou. All rights reserved. 7 | // 8 | 9 | #import "YoCelsiusRequestParameterSerializer.h" 10 | 11 | static NSString *appIdKey = @"YC_8c0e04b52e6da9e67c51a102d6269a60"; 12 | 13 | @implementation YoCelsiusRequestParameterSerializer 14 | 15 | - (id)serializeRequestParameter:(id)requestParameter { 16 | 17 | NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:requestParameter]; 18 | params[@"APPID"] = appIdKey; 19 | 20 | return params; 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /YoCelsius/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // YoCelsius 4 | // 5 | // Created by XianMingYou on 15/2/15. 6 | // 7 | // https://github.com/YouXianMing 8 | // http://www.cnblogs.com/YouXianMing/ 9 | // 10 | 11 | #import 12 | #import "AppDelegate.h" 13 | 14 | int main(int argc, char * argv[]) { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /YoCelsius/pop/POP.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #ifndef POP_POP_H 11 | #define POP_POP_H 12 | 13 | #import "POPDefines.h" 14 | 15 | #import "POPAnimatableProperty.h" 16 | #import "POPAnimatablePropertyTypes.h" 17 | #import "POPAnimation.h" 18 | #import "POPAnimationEvent.h" 19 | #import "POPAnimationExtras.h" 20 | #import "POPAnimationTracer.h" 21 | #import "POPAnimator.h" 22 | #import "POPBasicAnimation.h" 23 | #import "POPCustomAnimation.h" 24 | #import "POPDecayAnimation.h" 25 | #import "POPGeometry.h" 26 | #import "POPLayerExtras.h" 27 | #import "POPPropertyAnimation.h" 28 | #import "POPSpringAnimation.h" 29 | 30 | #endif /* POP_POP_H */ 31 | -------------------------------------------------------------------------------- /YoCelsius/pop/POPAction.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #ifndef POPACTION_H 11 | #define POPACTION_H 12 | 13 | #import 14 | 15 | #import "POPDefines.h" 16 | 17 | #ifdef __cplusplus 18 | 19 | namespace POP { 20 | 21 | /** 22 | @abstract Disables Core Animation actions using RAII. 23 | @discussion The disablement of actions is scoped to the current transaction. 24 | */ 25 | class ActionDisabler 26 | { 27 | BOOL state; 28 | 29 | public: 30 | ActionDisabler() POP_NOTHROW 31 | { 32 | state = [CATransaction disableActions]; 33 | [CATransaction setDisableActions:YES]; 34 | } 35 | 36 | ~ActionDisabler() 37 | { 38 | [CATransaction setDisableActions:state]; 39 | } 40 | }; 41 | 42 | /** 43 | @abstract Enables Core Animation actions using RAII. 44 | @discussion The enablement of actions is scoped to the current transaction. 45 | */ 46 | class ActionEnabler 47 | { 48 | BOOL state; 49 | 50 | public: 51 | ActionEnabler() POP_NOTHROW 52 | { 53 | state = [CATransaction disableActions]; 54 | [CATransaction setDisableActions:NO]; 55 | } 56 | 57 | ~ActionEnabler() 58 | { 59 | [CATransaction setDisableActions:state]; 60 | } 61 | }; 62 | 63 | } 64 | 65 | #endif /* __cplusplus */ 66 | 67 | #endif /* POPACTION_H */ 68 | -------------------------------------------------------------------------------- /YoCelsius/pop/POPAnimatablePropertyTypes.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | typedef void (^POPAnimatablePropertyReadBlock)(id obj, CGFloat values[]); 11 | typedef void (^POPAnimatablePropertyWriteBlock)(id obj, const CGFloat values[]); 12 | -------------------------------------------------------------------------------- /YoCelsius/pop/POPAnimationEvent.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | /** 13 | @abstract Enumeraton of animation event types. 14 | */ 15 | typedef NS_ENUM(NSUInteger, POPAnimationEventType) { 16 | kPOPAnimationEventPropertyRead = 0, 17 | kPOPAnimationEventPropertyWrite, 18 | kPOPAnimationEventToValueUpdate, 19 | kPOPAnimationEventFromValueUpdate, 20 | kPOPAnimationEventVelocityUpdate, 21 | kPOPAnimationEventBouncinessUpdate, 22 | kPOPAnimationEventSpeedUpdate, 23 | kPOPAnimationEventFrictionUpdate, 24 | kPOPAnimationEventMassUpdate, 25 | kPOPAnimationEventTensionUpdate, 26 | kPOPAnimationEventDidStart, 27 | kPOPAnimationEventDidStop, 28 | kPOPAnimationEventDidReachToValue, 29 | kPOPAnimationEventAutoreversed 30 | }; 31 | 32 | /** 33 | @abstract The base animation event class. 34 | */ 35 | @interface POPAnimationEvent : NSObject 36 | 37 | /** 38 | @abstract The event type. See {@ref POPAnimationEventType} for possible values. 39 | */ 40 | @property (readonly, nonatomic, assign) POPAnimationEventType type; 41 | 42 | /** 43 | @abstract The time of event. 44 | */ 45 | @property (readonly, nonatomic, assign) CFTimeInterval time; 46 | 47 | /** 48 | @abstract Optional string describing the animation at time of event. 49 | */ 50 | @property (readonly, nonatomic, copy) NSString *animationDescription; 51 | 52 | @end 53 | 54 | /** 55 | @abstract An animation event subclass for recording value and velocity. 56 | */ 57 | @interface POPAnimationValueEvent : POPAnimationEvent 58 | 59 | /** 60 | @abstract The value recorded. 61 | */ 62 | @property (readonly, nonatomic, strong) id value; 63 | 64 | /** 65 | @abstract The velocity recorded, if any. 66 | */ 67 | @property (readonly, nonatomic, strong) id velocity; 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /YoCelsius/pop/POPAnimationEventInternal.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "POPAnimationEvent.h" 13 | 14 | @interface POPAnimationEvent () 15 | 16 | /** 17 | @abstract Default initializer. 18 | */ 19 | - (instancetype)initWithType:(POPAnimationEventType)type time:(CFTimeInterval)time; 20 | 21 | /** 22 | @abstract Readwrite redefinition of public property. 23 | */ 24 | @property (readwrite, nonatomic, copy) NSString *animationDescription; 25 | 26 | @end 27 | 28 | @interface POPAnimationValueEvent () 29 | 30 | /** 31 | @abstract Default initializer. 32 | */ 33 | - (instancetype)initWithType:(POPAnimationEventType)type time:(CFTimeInterval)time value:(id)value; 34 | 35 | /** 36 | @abstract Readwrite redefinition of public property. 37 | */ 38 | @property (readwrite, nonatomic, strong) id velocity; 39 | 40 | @end 41 | 42 | -------------------------------------------------------------------------------- /YoCelsius/pop/POPAnimationExtras.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "POPDefines.h" 13 | #import "POPSpringAnimation.h" 14 | 15 | /** 16 | @abstract The current drag coefficient. 17 | @discussion A value greater than 1.0 indicates Simulator slow-motion animations are enabled. Defaults to 1.0. 18 | */ 19 | extern CGFloat POPAnimationDragCoefficient(void); 20 | 21 | @interface CAAnimation (POPAnimationExtras) 22 | 23 | /** 24 | @abstract Apply the current drag coefficient to animation speed. 25 | @discussion Convenience utility to respect Simulator slow-motion animation settings. 26 | */ 27 | - (void)pop_applyDragCoefficient; 28 | 29 | @end 30 | 31 | @interface POPSpringAnimation (POPAnimationExtras) 32 | 33 | /** 34 | @abstract Converts from spring bounciness and speed to tension, friction and mass dynamics values. 35 | */ 36 | + (void)convertBounciness:(CGFloat)bounciness speed:(CGFloat)speed toTension:(CGFloat *)outTension friction:(CGFloat *)outFriction mass:(CGFloat *)outMass; 37 | 38 | /** 39 | @abstract Converts from dynamics tension, friction and mass to spring bounciness and speed values. 40 | */ 41 | + (void)convertTension:(CGFloat)tension friction:(CGFloat)friction toBounciness:(CGFloat *)outBounciness speed:(CGFloat *)outSpeed; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /YoCelsius/pop/POPAnimationPrivate.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "POPAnimation.h" 11 | 12 | #define POP_ANIMATION_FRICTION_FOR_QC_FRICTION(qcFriction) (25.0 + (((qcFriction - 8.0) / 2.0) * (25.0 - 19.0))) 13 | #define POP_ANIMATION_TENSION_FOR_QC_TENSION(qcTension) (194.0 + (((qcTension - 30.0) / 50.0) * (375.0 - 194.0))) 14 | 15 | #define QC_FRICTION_FOR_POP_ANIMATION_FRICTION(fbFriction) (8.0 + 2.0 * ((fbFriction - 25.0)/(25.0 - 19.0))) 16 | #define QC_TENSION_FOR_POP_ANIMATION_TENSION(fbTension) (30.0 + 50.0 * ((fbTension - 194.0)/(375.0 - 194.0))) 17 | -------------------------------------------------------------------------------- /YoCelsius/pop/POPAnimationTracer.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "POPAnimationEvent.h" 13 | 14 | @class POPAnimation; 15 | 16 | /** 17 | @abstract Tracer of animation events to facilitate unit testing & debugging. 18 | */ 19 | @interface POPAnimationTracer : NSObject 20 | 21 | /** 22 | @abstract Start recording events. 23 | */ 24 | - (void)start; 25 | 26 | /** 27 | @abstract Stop recording events. 28 | */ 29 | - (void)stop; 30 | 31 | /** 32 | @abstract Resets any recoded events. Continues recording events if already started. 33 | */ 34 | - (void)reset; 35 | 36 | /** 37 | @abstract Property representing all recorded events. 38 | @discussion Events are returned in order of occurrence. 39 | */ 40 | @property (nonatomic, assign, readonly) NSArray *allEvents; 41 | 42 | /** 43 | @abstract Property representing all recorded write events for convenience. 44 | @discussion Events are returned in order of occurrence. 45 | */ 46 | @property (nonatomic, assign, readonly) NSArray *writeEvents; 47 | 48 | /** 49 | @abstract Queries for events of specified type. 50 | @param type The type of event to return. 51 | @returns An array of events of specified type in order of occurrence. 52 | */ 53 | - (NSArray *)eventsWithType:(POPAnimationEventType)type; 54 | 55 | /** 56 | @abstract Property indicating whether tracer should automatically log events and reset collection on animation completion. 57 | */ 58 | @property (nonatomic, assign) BOOL shouldLogAndResetOnCompletion; 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /YoCelsius/pop/POPAnimationTracerInternal.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "POPAnimationTracer.h" 13 | 14 | @interface POPAnimationTracer (Internal) 15 | 16 | /** 17 | @abstract Designated initializer. Pass the animation being traced. 18 | */ 19 | - (instancetype)initWithAnimation:(POPAnimation *)anAnim; 20 | 21 | /** 22 | @abstract Records read value. 23 | */ 24 | - (void)readPropertyValue:(id)aValue; 25 | 26 | /** 27 | @abstract Records write value. 28 | */ 29 | - (void)writePropertyValue:(id)aValue; 30 | 31 | /** 32 | Records to value update. 33 | */ 34 | - (void)updateToValue:(id)aValue; 35 | 36 | /** 37 | @abstract Records from value update. 38 | */ 39 | - (void)updateFromValue:(id)aValue; 40 | 41 | /** 42 | @abstract Records from value update. 43 | */ 44 | - (void)updateVelocity:(id)aValue; 45 | 46 | /** 47 | @abstract Records bounciness update. 48 | */ 49 | - (void)updateBounciness:(float)aFloat; 50 | 51 | /** 52 | @abstract Records speed update. 53 | */ 54 | - (void)updateSpeed:(float)aFloat; 55 | 56 | /** 57 | @abstract Records friction update. 58 | */ 59 | - (void)updateFriction:(float)aFloat; 60 | 61 | /** 62 | @abstract Records mass update. 63 | */ 64 | - (void)updateMass:(float)aFloat; 65 | 66 | /** 67 | @abstract Records tension update. 68 | */ 69 | - (void)updateTension:(float)aFloat; 70 | 71 | /** 72 | @abstract Records did add. 73 | */ 74 | - (void)didAdd; 75 | 76 | /** 77 | @abstract Records did start. 78 | */ 79 | - (void)didStart; 80 | 81 | /** 82 | @abstract Records did stop. 83 | */ 84 | - (void)didStop:(BOOL)finished; 85 | 86 | /** 87 | @abstract Records did reach to value. 88 | */ 89 | - (void)didReachToValue:(id)aValue; 90 | 91 | /** 92 | @abstract Records when an autoreverse animation takes place. 93 | */ 94 | - (void)autoreversed; 95 | 96 | @end 97 | -------------------------------------------------------------------------------- /YoCelsius/pop/POPAnimator.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @protocol POPAnimatorDelegate; 13 | 14 | /** 15 | @abstract The animator class renders animations. 16 | */ 17 | @interface POPAnimator : NSObject 18 | 19 | /** 20 | @abstract The shared animator instance. 21 | @discussion Consumers should generally use the shared instance in lieu of creating new instances. 22 | */ 23 | + (instancetype)sharedAnimator; 24 | 25 | #if !TARGET_OS_IPHONE 26 | /** 27 | @abstract Allows to select display to bind. Returns nil if failed to create the display link. 28 | */ 29 | - (instancetype)initWithDisplayID:(CGDirectDisplayID)displayID; 30 | #endif 31 | 32 | /** 33 | @abstract The optional animator delegate. 34 | */ 35 | @property (weak, nonatomic) id delegate; 36 | 37 | /** 38 | @abstract Retrieves the nominal refresh period of a display link. Returns zero if unavailable. 39 | */ 40 | @property (readonly, nonatomic) CFTimeInterval refreshPeriod; 41 | 42 | @end 43 | 44 | /** 45 | @abstract The animator delegate. 46 | */ 47 | @protocol POPAnimatorDelegate 48 | 49 | /** 50 | @abstract Called on each frame before animation application. 51 | */ 52 | - (void)animatorWillAnimate:(POPAnimator *)animator; 53 | 54 | /** 55 | @abstract Called on each frame after animation application. 56 | */ 57 | - (void)animatorDidAnimate:(POPAnimator *)animator; 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /YoCelsius/pop/POPCustomAnimation.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "POPAnimation.h" 11 | 12 | @class POPCustomAnimation; 13 | 14 | /** 15 | @abstract POPCustomAnimationBlock is the callback block of a custom animation. 16 | @discussion This block will be executed for each animation frame and should update the property or properties being animated based on current timing. 17 | @param target The object being animated. Reference the passed in target to help avoid retain loops. 18 | @param animation The custom animation instance. Use to determine the current and elapsed time since last callback. Reference the passed in animation to help avoid retain loops. 19 | @return Flag indicating whether the animation should continue animating. Return NO to indicate animation is done. 20 | */ 21 | typedef BOOL (^POPCustomAnimationBlock)(id target, POPCustomAnimation *animation); 22 | 23 | /** 24 | @abstract POPCustomAnimation is a concrete animation subclass for custom animations. 25 | */ 26 | @interface POPCustomAnimation : POPAnimation 27 | 28 | /** 29 | @abstract Creates and returns an initialized custom animation instance. 30 | @discussion This is the designated initializer. 31 | @param block The custom animation callback block. See {@ref POPCustomAnimationBlock}. 32 | @return The initialized custom animation instance. 33 | */ 34 | + (instancetype)animationWithBlock:(POPCustomAnimationBlock)block; 35 | 36 | /** 37 | @abstract The current animation time at time of callback. 38 | */ 39 | @property (readonly, nonatomic) CFTimeInterval currentTime; 40 | 41 | /** 42 | @abstract The elapsed animation time since last callback. 43 | */ 44 | @property (readonly, nonatomic) CFTimeInterval elapsedTime; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /YoCelsius/pop/POPCustomAnimation.mm: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "POPAnimationInternal.h" 11 | 12 | #import "POPCustomAnimation.h" 13 | 14 | @interface POPCustomAnimation () 15 | @property (nonatomic, copy) POPCustomAnimationBlock animate; 16 | @end 17 | 18 | @implementation POPCustomAnimation 19 | @synthesize currentTime = _currentTime; 20 | @synthesize elapsedTime = _elapsedTime; 21 | @synthesize animate = _animate; 22 | 23 | + (instancetype)animationWithBlock:(BOOL(^)(id target, POPCustomAnimation *))block 24 | { 25 | POPCustomAnimation *b = [[self alloc] _init]; 26 | b.animate = block; 27 | return b; 28 | } 29 | 30 | - (id)_init 31 | { 32 | self = [super _init]; 33 | if (nil != self) { 34 | _state->type = kPOPAnimationCustom; 35 | } 36 | return self; 37 | } 38 | 39 | - (CFTimeInterval)beginTime 40 | { 41 | POPAnimationState *s = POPAnimationGetState(self); 42 | return s->startTime > 0 ? s->startTime : s->beginTime; 43 | } 44 | 45 | - (BOOL)_advance:(id)object currentTime:(CFTimeInterval)currentTime elapsedTime:(CFTimeInterval)elapsedTime 46 | { 47 | _currentTime = currentTime; 48 | _elapsedTime = elapsedTime; 49 | return _animate(object, self); 50 | } 51 | 52 | - (void)_appendDescription:(NSMutableString *)s debug:(BOOL)debug 53 | { 54 | [s appendFormat:@"; elapsedTime = %f; currentTime = %f;", _elapsedTime, _currentTime]; 55 | } 56 | 57 | @end 58 | 59 | /** 60 | * Note that only the animate block is copied, but not the current/elapsed times 61 | */ 62 | @implementation POPCustomAnimation (NSCopying) 63 | 64 | - (instancetype)copyWithZone:(NSZone *)zone { 65 | 66 | POPCustomAnimation *copy = [super copyWithZone:zone]; 67 | 68 | if (copy) { 69 | copy.animate = self.animate; 70 | } 71 | 72 | return copy; 73 | } 74 | 75 | @end -------------------------------------------------------------------------------- /YoCelsius/pop/POPDefines.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #ifndef POP_POPDefines_h 11 | #define POP_POPDefines_h 12 | 13 | #import 14 | 15 | #ifdef __cplusplus 16 | # define POP_EXTERN_C_BEGIN extern "C" { 17 | # define POP_EXTERN_C_END } 18 | #else 19 | # define POP_EXTERN_C_BEGIN 20 | # define POP_EXTERN_C_END 21 | #endif 22 | 23 | #define POP_ARRAY_COUNT(x) sizeof(x) / sizeof(x[0]) 24 | 25 | #if defined (__cplusplus) && defined (__GNUC__) 26 | # define POP_NOTHROW __attribute__ ((nothrow)) 27 | #else 28 | # define POP_NOTHROW 29 | #endif 30 | 31 | #if defined(POP_USE_SCENEKIT) 32 | # if TARGET_OS_MAC || TARGET_OS_IPHONE 33 | # define SCENEKIT_SDK_AVAILABLE 1 34 | # endif 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /YoCelsius/pop/POPGeometry.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #if TARGET_OS_IPHONE 13 | #import 14 | #endif 15 | 16 | #if !TARGET_OS_IPHONE 17 | 18 | /** NSValue extensions to support animatable types. */ 19 | @interface NSValue (POP) 20 | 21 | /** 22 | @abstract Creates an NSValue given a CGPoint. 23 | */ 24 | + (NSValue *)valueWithCGPoint:(CGPoint)point; 25 | 26 | /** 27 | @abstract Creates an NSValue given a CGSize. 28 | */ 29 | + (NSValue *)valueWithCGSize:(CGSize)size; 30 | 31 | /** 32 | @abstract Creates an NSValue given a CGRect. 33 | */ 34 | + (NSValue *)valueWithCGRect:(CGRect)rect; 35 | 36 | /** 37 | @abstract Creates an NSValue given a CFRange. 38 | */ 39 | + (NSValue *)valueWithCFRange:(CFRange)range; 40 | 41 | /** 42 | @abstract Creates an NSValue given a CGAffineTransform. 43 | */ 44 | + (NSValue *)valueWithCGAffineTransform:(CGAffineTransform)transform; 45 | 46 | /** 47 | @abstract Returns the underlying CGPoint value. 48 | */ 49 | - (CGPoint)CGPointValue; 50 | 51 | /** 52 | @abstract Returns the underlying CGSize value. 53 | */ 54 | - (CGSize)CGSizeValue; 55 | 56 | /** 57 | @abstract Returns the underlying CGRect value. 58 | */ 59 | - (CGRect)CGRectValue; 60 | 61 | /** 62 | @abstract Returns the underlying CFRange value. 63 | */ 64 | - (CFRange)CFRangeValue; 65 | 66 | /** 67 | @abstract Returns the underlying CGAffineTransform value. 68 | */ 69 | - (CGAffineTransform)CGAffineTransformValue; 70 | 71 | @end 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /YoCelsius/pop/POPMath.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import 13 | 14 | #import "POPDefines.h" 15 | #import "POPVector.h" 16 | 17 | NS_INLINE CGFloat sqrtr(CGFloat f) 18 | { 19 | #if CGFLOAT_IS_DOUBLE 20 | return sqrt(f); 21 | #else 22 | return sqrtf(f); 23 | #endif 24 | } 25 | 26 | // round to nearest sub; pass 2.0 to round to every 0.5 (eg: retina pixels) 27 | NS_INLINE CGFloat POPSubRound(CGFloat f, CGFloat sub) 28 | { 29 | return round(f * sub) / sub; 30 | } 31 | 32 | #define MIX(a, b, f) ((a) + (f) * ((b) - (a))) 33 | 34 | // the longer the duration, the higher the necessary precision 35 | #define SOLVE_EPS(dur) (1. / (1000. * (dur))) 36 | 37 | #define _EQLF_(x, y, epsilon) (fabsf ((x) - (y)) < epsilon) 38 | 39 | extern void POPInterpolateVector(NSUInteger count, CGFloat *dst, const CGFloat *from, const CGFloat *to, CGFloat f); 40 | 41 | extern double POPTimingFunctionSolve(const double vec[4], double t, double eps); 42 | 43 | // quadratic mapping of t [0, 1] to [start, end] 44 | extern double POPQuadraticOutInterpolation(double t, double start, double end); 45 | 46 | // normalize value to [0, 1] based on its range [startValue, endValue] 47 | extern double POPNormalize(double value, double startValue, double endValue); 48 | 49 | // project a normalized value [0, 1] to a given range [start, end] 50 | extern double POPProjectNormal(double n, double start, double end); 51 | 52 | // solve a quadratic equation of the form a * x^2 + b * x + c = 0 53 | extern void POPQuadraticSolve(CGFloat a, CGFloat b, CGFloat c, CGFloat &x1, CGFloat &x2); 54 | 55 | // for a given tension return the bouncy 3 friction that produces no bounce 56 | extern double POPBouncy3NoBounce(double tension); 57 | --------------------------------------------------------------------------------