要运行示例项目,请先克隆仓库,然后从 Example 目录运行 pod install
。
SGReviewTableView 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod "SGReviewTableView"
http://cocoadocs.org/docsets/SGReviewTableView/
@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
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
}
}
SGReviewTableViewController 接受一个 SGReview 对象数组。当前只有 0.0-5.0 的评分是有效的。
SGReview *review = [[SGReview alloc] initWithRating:5.0 content:@"Excellent!" andDate:[NSDate new]];
let review = SGReview(rating:4.5, content:"Awesome!", andDate:Date())
当前自定义有限。以下可以在 SGReviewTableViewController 上进行自定义
Stephen Goodman,[email protected]
SGReviewTableView 在 MIT 许可下提供。有关更多信息,请参阅 LICENSE 文件。