Ich habe eine Tabellenansicht. Im Anschluss ist mein cellForRowAtIndexPath CodeBestimmte Ansichten von uitableview ausblenden
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = nil;
cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:@""];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:nil];
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
}
orderDetailsLabel = [[UILabel alloc]init];
shipmentStatusLabel = [[UILabel alloc]init];
ratingandFeedbackLabel = [[UILabel alloc]init];
HCSStarRatingView *starRatingView;
UILabel *suggestionsLabel;
UILabel *checkBoxLabel1;
UIButton *checkBoxButton1;
UIButton *saveButton;
UIImageView *checkbox1;
UITextView *feedBackTextView;
suggestionsLabel = [[UILabel alloc]init];
checkBoxLabel1 = [[UILabel alloc]init];
checkBoxButton1 = [UIButton buttonWithType:UIButtonTypeCustom];
checkbox1 = [[UIImageView alloc]init];
feedBackTextView = [[UITextView alloc]init];
if (indexPath.row == 0)
{
ratingandFeedbackLabel.frame = CGRectMake(20, 5, 350, 20);
ratingandFeedbackLabel.text = [ratingandFeedbackArray objectAtIndex:indexPath.row];
ratingandFeedbackLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:14];
starRatingView = [[HCSStarRatingView alloc] initWithFrame:CGRectMake(20, 15, 100, 50)];
starRatingView.maximumValue = 5;
starRatingView.minimumValue = 0;
starRatingView.value = 0;
starRatingView.tintColor = [UIColor colorWithRed:254/255.0 green:174/255.0 blue:77/255.0 alpha:1];
starRatingView.backgroundColor = [UIColor clearColor];
[starRatingView addTarget:self action:@selector(didChangeValue:) forControlEvents:UIControlEventValueChanged];
}
else if (indexPath.row == 1)
{
checkbox1.frame = CGRectMake(20, 0, 20, 20);
checkbox1.image = [UIImage imageNamed:@"[email protected]"];
checkBoxButton1.frame = CGRectMake(20, 0, 20, 20);
[checkBoxButton1 addTarget:self action:@selector(checkBoxButton1Tapped:) forControlEvents:UIControlEventTouchUpInside];
suggestionsLabel.frame = CGRectMake(10, 185, 300, 30);
suggestionsLabel.text = @"Your feedback will help us make better *";
suggestionsLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:13];
CGRect screenRect = [[UIScreen mainScreen] bounds];
if (screenRect.size.height == 480)
{
tableView.scrollEnabled = YES;
feedBackTextView.frame = CGRectMake(18, 220, 285, 100);
saveButton.frame = CGRectMake(120, 330, 70, 30);
}
UIColor *borderColor = [UIColor colorWithRed:204.0/255.0 green:204.0/255.0 blue:204.0/255.0 alpha:1.0];
feedBackTextView.text = @"";
[saveButton setTitle:@"Save" forState:UIControlStateNormal];
[saveButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[saveButton addTarget:self action:@selector(buttonAction) forControlEvents:UIControlEventTouchUpInside];
}
tableView.tableFooterView = [UIView new];
[cell.contentView addSubview:orderDetailsLabel];
[cell.contentView addSubview:shipmentStatusLabel];
//[cell.contentView addSubview:starRatingImageView];
[cell.contentView addSubview:ratingandFeedbackLabel];
[cell.contentView addSubview:suggestionsLabel];
[cell.contentView addSubview:checkBoxButton1];
[cell.contentView addSubview:checkBoxLabel1];
[cell.contentView addSubview:feedBackTextView];
[cell.contentView addSubview:starRatingView];
[cell.contentView addSubview:saveButton];
return cell;
}
In anderen Verfahren genannt, receiveStarRatingData, Im den Statuscode vom Benutzer zu empfangen. Wenn der Statuscode 1 ist, möchte ich Kontrollkästchen, SuggestionsLabel, Save Button und FeedBackTextView nicht anzeigen. Wie kann ich sie verstecken oder aus der Methode receiveStarRatingData entfernen?
halten Sie Subviews Ihre InhaltAlle hinzufügen. Dies wird die Benutzeroberfläche langsam machen und manchmal nicht mehr reagieren – Joshua