SGReviewTableView 0.2.3

SGReviewTableView 0.2.3

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布上次发布2017年1月

Stephen Goodman维护。




  • goodmase

SGReviewTableView Example

示例项目

要运行示例项目,请先克隆仓库,然后从 Example 目录运行 pod install

安装

SGReviewTableView 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中

pod "SGReviewTableView"

文档

http://cocoadocs.org/docsets/SGReviewTableView/

用法

基本示例

Objective-C

@import SGReviewTableView;
@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    //create a review
    SGReview *review = [[SGReview alloc] initWithRating:5.0 content:@"Excellent!" andDate:[NSDate new]];

    SGReviewTableViewController *reviewTableView = [[SGReviewTableViewController alloc] initWithReviews:@[review]];
    reviewTableView.graphBarColor = [UIColor redColor];
    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:reviewTableView];
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.window.backgroundColor = [UIColor whiteColor];
    self.window.rootViewController = nav;
    [self.window makeKeyAndVisible];

    return YES;
}

@end

Swift

import UIKit
import SGReviewTableView

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?


    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        let r = SGReview(rating:4.5, content:"Awesome!", andDate:Date())
        let reviewTableView = SGReviewTableViewController(reviews: [r!])
        reviewTableView?.graphBarColor = UIColor.red;
        let nav = UINavigationController(rootViewController: reviewTableView!)
        self.window = UIWindow(frame: UIScreen.main.bounds)
        self.window?.rootViewController = nav
        self.window?.makeKeyAndVisible()

        return true
    }
}

SGReview

SGReviewTableViewController 接受一个 SGReview 对象数组。当前只有 0.0-5.0 的评分是有效的。

Objective-C

SGReview *review = [[SGReview alloc] initWithRating:5.0 content:@"Excellent!" andDate:[NSDate new]];

Swift

let review = SGReview(rating:4.5, content:"Awesome!", andDate:Date())

自定义

当前自定义有限。以下可以在 SGReviewTableViewController 上进行自定义

  • graphBarColor - 自定义表视图顶部直方图条的颜色。

作者

Stephen Goodman,[email protected]

许可证

SGReviewTableView 在 MIT 许可下提供。有关更多信息,请参阅 LICENSE 文件。