MRArticleViewController

所属分类:collect
开发工具:Swift
文件大小:0KB
下载次数:0
上传日期:2017-02-27 02:16:05
上 传 者sh-1993
说明:  为新闻文章轻松创建UIViewControllers,类似于新闻应用程序中的文章。,
(Easily create UIViewControllers for news articles similar to those in the News app.,)

文件列表:
.swift-version (4, 2017-02-26)
.travis.yml (606, 2017-02-26)
CHANGELOG.md (545, 2017-02-26)
Example/ (0, 2017-02-26)
Example/MRArticleViewController.xcodeproj/ (0, 2017-02-26)
Example/MRArticleViewController.xcodeproj/project.pbxproj (26883, 2017-02-26)
Example/MRArticleViewController.xcodeproj/project.xcworkspace/ (0, 2017-02-26)
Example/MRArticleViewController.xcodeproj/project.xcworkspace/contents.xcworkspacedata (168, 2017-02-26)
Example/MRArticleViewController.xcodeproj/xcshareddata/ (0, 2017-02-26)
Example/MRArticleViewController.xcodeproj/xcshareddata/xcschemes/ (0, 2017-02-26)
Example/MRArticleViewController.xcodeproj/xcshareddata/xcschemes/MRArticleViewController-Example.xcscheme (4674, 2017-02-26)
Example/MRArticleViewController.xcworkspace/ (0, 2017-02-26)
Example/MRArticleViewController.xcworkspace/contents.xcworkspacedata (241, 2017-02-26)
Example/MRArticleViewController/ (0, 2017-02-26)
Example/MRArticleViewController/AppDelegate.swift (2168, 2017-02-26)
Example/MRArticleViewController/Base.lproj/ (0, 2017-02-26)
Example/MRArticleViewController/Base.lproj/LaunchScreen.xib (3717, 2017-02-26)
Example/MRArticleViewController/Base.lproj/Main.storyboard (1780, 2017-02-26)
Example/MRArticleViewController/Images.xcassets/ (0, 2017-02-26)
Example/MRArticleViewController/Images.xcassets/AppIcon.appiconset/ (0, 2017-02-26)
Example/MRArticleViewController/Images.xcassets/AppIcon.appiconset/Contents.json (586, 2017-02-26)
Example/MRArticleViewController/Images.xcassets/Contents.json (62, 2017-02-26)
Example/MRArticleViewController/Images.xcassets/inception.imageset/ (0, 2017-02-26)
Example/MRArticleViewController/Images.xcassets/inception.imageset/Contents.json (306, 2017-02-26)
Example/MRArticleViewController/Images.xcassets/inception.imageset/inception.jpg (782087, 2017-02-26)
Example/MRArticleViewController/Images.xcassets/interstellar.imageset/ (0, 2017-02-26)
Example/MRArticleViewController/Images.xcassets/interstellar.imageset/Contents.json (309, 2017-02-26)
Example/MRArticleViewController/Images.xcassets/interstellar.imageset/interstellar.jpg (1694208, 2017-02-26)
Example/MRArticleViewController/Images.xcassets/pulpfiction.imageset/ (0, 2017-02-26)
Example/MRArticleViewController/Images.xcassets/pulpfiction.imageset/Contents.json (308, 2017-02-26)
Example/MRArticleViewController/Images.xcassets/pulpfiction.imageset/pulpfiction.jpg (79842, 2017-02-26)
Example/MRArticleViewController/Info.plist (1149, 2017-02-26)
Example/MRArticleViewController/ViewController.swift (2797, 2017-02-26)
Example/Podfile (193, 2017-02-26)
Example/Podfile.lock (324, 2017-02-26)
Example/Pods/ (0, 2017-02-26)
Example/Pods/Local Podspecs/ (0, 2017-02-26)
Example/Pods/Local Podspecs/MRArticleViewController.podspec.json (924, 2017-02-26)
Example/Pods/Manifest.lock (324, 2017-02-26)
... ...

# MRArticleViewController [![CI Status](http://img.shields.io/travis/mrigdon/MRArticleViewController.svg?style=flat)](https://travis-ci.org/mrigdon/MRArticleViewController) [![Version](https://img.shields.io/cocoapods/v/MRArticleViewController.svg?style=flat)](http://cocoapods.org/pods/MRArticleViewController) [![License](https://img.shields.io/cocoapods/l/MRArticleViewController.svg?style=flat)](http://cocoapods.org/pods/MRArticleViewController) [![Platform](https://img.shields.io/cocoapods/p/MRArticleViewController.svg?style=flat)](http://cocoapods.org/pods/MRArticleViewController) This framework allows you to easily setup View Controllers to display News Articles inspired by those from the Apple News App. Simply set the required fields and run, and you will have a nice looking view for your articles. ![Preview](https://raw.githubusercontent.com/mrigdon/MRArticleViewController/master/preview1.png) ![Preview](https://raw.githubusercontent.com/mrigdon/MRArticleViewController/master/preview2.png) ![Preview](https://raw.githubusercontent.com/mrigdon/MRArticleViewController/master/preview3.png) ## Example To run the example project, clone the repo, and run `pod install` from the Example directory first. ## Requirements - Swift 3: use current - Swift 2: use v0.2.0 ## Installation MRArticleViewController is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your Podfile: ```ruby pod 'MRArticleViewController' ``` ## Usage 1. Import the module ```swift import MRArticleViewController ``` 2. Subclass `ArticleViewController` ```swift class ViewController: ArticleViewController ``` 3. In `viewDidLoad`, set the following **required** properties *before* `super.viewDidLoad()`: ```swift override func viewDidLoad() { // required imageView.image = UIImage(named: "pulpfiction")! headline = "LA gangsters witness supposed \"Divine Intervention\"" author = "Quentin Tarantino" date = NSDate() body = bodyText super.viewDidLoad() } ``` 4. Optional: In `viewDidLoad`, set the following **optional** properties *before* `super.viewDidLoad()`: ```swift ... // Uses the algorithm from UIImageColors to extract the colors from the image and color the // background, headline, author, date, and body accordingly. Defaults to false, but highly // recommended to set to true. More on this feature below. autoColored = true // If you don't like the autoColor feature, you can also color each component individually backgroundColor = UIColor.black headlineColor = UIColor.yellow authorColor = UIColor.orange dateColor = UIColor.gray bodyColor = UIColor.gray super.viewDidLoad() ``` Done! :beers: ## More on `autoColored` This library leverages the algorithm from [UIImageColors](https://github.com/jathu/UIImageColors). Setting `autoColor = true` extracts the colors from the `image` and applies the * background color to the background * the primary color to the headline * the detail color to the date and body * and the secondary color to the author. Note that UIImageColors is not a dependency, the code has just been ported into this library. ## To-do Want a feature you don't see? Submit an issue and I'll add it to the to-do list, or hack it yourself and submit a pull request. - [ ] Add new styles - [ ] Swift package manager ## Author Matthew Rigdon, rigdonmr@gmail.com ## License MRArticleViewController is available under the MIT license. See the LICENSE file for more info. Please also refer to Panic's [original license](https://github.com/panicinc/ColorArt/#license) for the autoColor feature.

近期下载者

相关文件


收藏者