Here's my code:
NSMutableArray *ratings = [[NSMutableArray alloc] init];
NSMutableDictionary *eachRating = [[NSMutableDictionary alloc] init];
for (UIView *subview in self.rateServiceView.subviews) {
if ([subview isKindOfClass:[RSTapRateView class]]) {
RSTapRateView *rs = (RSTapRateView *)subview;
[eachRating setObject:rs.rateId forKey:@"iRatingId"];
[eachRating setObject:[NSNumber numberWithInt:rs.rating] forKey:@"iRate"];
[ratings addObject:eachRating];
}
}
Instead of getting these values:
{
iRate = 1;
iRatingId = 1;
},
{
iRate = 5;
iRatingId = 2;
},
{
iRate = 2;
iRatingId = 3;
}
I'm getting these values:
{
iRate = 2;
iRatingId = 3;
},
{
iRate = 2;
iRatingId = 3;
},
{
iRate = 2;
iRatingId = 3;
}
When I logged the result for each iteration, the last object replaces all the existing objects and add a new object for itself.