diff --git a/iOSProject/pyunrihae/pyunrihae/Base.lproj/Main.storyboard b/iOSProject/pyunrihae/pyunrihae/Base.lproj/Main.storyboard index 963d0863..65b110b5 100644 --- a/iOSProject/pyunrihae/pyunrihae/Base.lproj/Main.storyboard +++ b/iOSProject/pyunrihae/pyunrihae/Base.lproj/Main.storyboard @@ -545,7 +545,7 @@ - + @@ -614,9 +614,9 @@ - + @@ -943,7 +943,7 @@ - + @@ -955,7 +955,7 @@ - + @@ -2290,10 +2290,10 @@ - @@ -2374,7 +2374,7 @@ - + @@ -2933,7 +2933,7 @@ - + diff --git a/iOSProject/pyunrihae/pyunrihae/Image.swift b/iOSProject/pyunrihae/pyunrihae/Image.swift index bccae5db..dc31a393 100644 --- a/iOSProject/pyunrihae/pyunrihae/Image.swift +++ b/iOSProject/pyunrihae/pyunrihae/Image.swift @@ -13,45 +13,36 @@ class Image { image.layer.cornerRadius = image.layer.frame.height/2 image.clipsToBounds = true } - static func drawStar(numberOfPlaces: Double, grade_avg: Double, gradeLabel: UILabel, starView: UIView) { + static func drawStar(numberOfPlaces: Double, grade_avg: Double, gradeLabel: UILabel, starView: UIImageView) { for sub in starView.subviews { sub.removeFromSuperview() } let multiplier = pow(10.0, numberOfPlaces) let grade = round(Double(grade_avg) * multiplier) / multiplier gradeLabel.text = String(grade) - if grade - Double(Int(grade)) >= 0.5 { - let starImage = UIImage(named: "stars.png") - let cgImage = starImage?.cgImage - let croppedCGImage: CGImage = cgImage!.cropping(to: CGRect(x: (starImage?.size.width)! * 4 / 5, y: 10, width: (starImage?.size.width)!, height: starImage!.size.height))! - let uiImage = UIImage(cgImage: croppedCGImage) - let imageView = UIImageView(image: uiImage) - imageView.frame = CGRect(x: Int(grade) * 18 - 3, y: 0, width: 17, height: 15) - starView.addSubview(imageView) - for i in (Int(grade) + 1)..<5 { - let emptyStarImage = UIImage(named: "empty_star.png") - let imageView = UIImageView(image: emptyStarImage) - imageView.contentMode = .scaleAspectFit - imageView.frame = CGRect(x: i * 18 - 3, y: 0, width: 17, height: 15) - starView.addSubview(imageView) - } - } else{ - for i in Int(grade)..<5 { - let emptyStarImage = UIImage(named: "empty_star.png") - let imageView = UIImageView(image: emptyStarImage) - imageView.contentMode = .scaleAspectFit - imageView.frame = CGRect(x: i * 18 - 3, y: 0, width: 17, height: 15) - starView.addSubview(imageView) - } - } - for i in 0..