Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to add star rating in UITableView
    primarykey
    data
    text
    <p>This is the error that i got when i was trying to implement star ratings to my UITableView. 2012-09-28 18:41:33.698 PlanMyDay[4533:c07] adssadgadf(</p> <p>( "4.5", "4.1", 4, "3.9", "4.2", "4.1", "", "4.3", "3.9", "4.4", "", 4, "3.9", "3.9", "", 4, "3.2", "3.6", "3.3", "3.8" )</p> <blockquote> <p>"2012-09-28 17:33:38.741 PlanMyDay[4211:c07] <strong>* Terminating app due to uncaught exception 'NSRangeException', reason: '*</strong> -[__NSArrayM objectAtIndex:]: index 1 beyond bounds [0 .. 0]'</p> <p><em>*</em> First throw call stack: (0x1873022 0x13e5cd6 0x185fd88 0x4da43 0x5e2c54 0x5e33ce 0x5cecbd 0x5dd6f1 0x586d42 0x1874e42 0x1ba9679 0x1bb3579 0x1b384f7 0x1b3a3f6 0x1b39ad0 0x184799e 0x17de640 0x17aa4c6 0x17a9d84 0x17a9c9b 0x1a897d8 0x1a8988a 0x548626 0x2b82 0x2af5) terminate called throwing an exception(lldb) "</p> </blockquote> <pre><code> - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; // if a cell can be reused, it returns a UITableViewCell with the associated identifier or nil if no such cell exists UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; // if no cell to reuse, then create a new one if (cell == nil) { NSDictionary *testrate =[ratings1 objectAtIndex:indexPath.row]; NSString *str=[[NSString alloc]initWithFormat:@"%@",testrate]; NSInteger n=[str intValue]; NSLog(@"workrate:%@", str); if (n &gt;=4) { CGRect starFrame = CGRectMake(65,60, 15, 15); //CGSize starFrame = CGSizeMake(20,20); UIImageView *starImage = [[[UIImageView alloc] initWithFrame:starFrame] autorelease]; starImage.image = [UIImage imageNamed:@"star.png"]; starImage.backgroundColor=[UIColor clearColor]; [cell.contentView addSubview:starImage]; CGRect starFrame1 = CGRectMake(80,60, 15, 15); UIImageView *starImage1 = [[[UIImageView alloc] initWithFrame:starFrame1 ] autorelease]; starImage1.image = [UIImage imageNamed:@"star.png"]; starImage1.backgroundColor=[UIColor clearColor]; [cell.contentView addSubview:starImage1]; CGRect starFrame2 = CGRectMake(95,60, 15, 15); UIImageView *starImage2 = [[[UIImageView alloc] initWithFrame:starFrame2 ] autorelease]; starImage2.image = [UIImage imageNamed:@"star.png"]; starImage2.backgroundColor=[UIColor clearColor]; [cell.contentView addSubview:starImage2]; CGRect starFrame3 = CGRectMake(110,60, 15, 15); UIImageView *starImage3 = [[[UIImageView alloc] initWithFrame:starFrame3 ] autorelease]; starImage3.image = [UIImage imageNamed:@"star.png"]; starImage3.backgroundColor=[UIColor clearColor]; [cell.contentView addSubview:starImage3]; CGRect starFrame4= CGRectMake(125,60, 15, 15); UIImageView *starImage4 = [[[UIImageView alloc] initWithFrame:starFrame4 ] autorelease]; starImage4.image = [UIImage imageNamed:@"star.png"]; starImage4.backgroundColor=[UIColor clearColor]; [cell.contentView addSubview:starImage4]; } else if(n &gt;=3&amp;&amp;n&lt;=4) { CGRect starFrame = CGRectMake(65,60, 15, 15); //CGSize starFrame = CGSizeMake(20,20); UIImageView *starImage = [[[UIImageView alloc] initWithFrame:starFrame] autorelease]; starImage.image = [UIImage imageNamed:@"star.png"]; starImage.backgroundColor=[UIColor clearColor]; [cell.contentView addSubview:starImage]; CGRect starFrame1 = CGRectMake(80,60, 15, 15); UIImageView *starImage1 = [[[UIImageView alloc] initWithFrame:starFrame1 ] autorelease]; starImage1.image = [UIImage imageNamed:@"star.png"]; starImage1.backgroundColor=[UIColor clearColor]; [cell.contentView addSubview:starImage1]; CGRect starFrame2 = CGRectMake(95,60, 15, 15); UIImageView *starImage2 = [[[UIImageView alloc] initWithFrame:starFrame2 ] autorelease]; starImage2.image = [UIImage imageNamed:@"star.png"]; starImage2.backgroundColor=[UIColor clearColor]; [cell.contentView addSubview:starImage2]; } return cell; } </code></pre> <p>please help me to complete my project</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload