Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  2. static NSString *CellIdentifier = @"Cell";
  3. preferredCustomCell *mycell = (preferredCustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  4.  
  5. UIView *backgroundView = [[UIView alloc] initWithFrame:mycell.selectedBackgroundView.frame];
  6. [backgroundView setBackgroundColor:[UIColor colorWithRed:189/255.f green:189/255.f blue:189/255.f alpha:0.25]];
  7. [mycell setSelectedBackgroundView:backgroundView];
  8. SearchbackView.hidden = YES;
  9.  
  10. // Configure the cell...
  11. if (mycell == nil) {
  12. mycell = [[preferredCustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
  13. }
  14.  
  15. MyData *dealerData = Nil;
  16. if (tableView == self.searchDisplayController.searchResultsTableView) {
  17. dealerData = [searchResults objectAtIndex:indexPath.row];
  18. } else {
  19. dealerData = [cellData objectAtIndex:indexPath.row];
  20. }
  21.  
  22. dealerInfo = [NSString stringWithFormat:@"%@n%@n%@%@%@%@%@n%@n%@", dealerData.businessName, dealerData.address, dealerData.city,@", ", dealerData.state, @", ", dealerData.zip, dealerData.phone, dealerData.email]; // data.address;
  23.  
  24. mycell.dealerInfoLbl.text = dealerInfo;
  25. mycell.dealerInfoLbl.numberOfLines = 0;
  26.  
  27. mycell.selectDealerBtn.tag = indexPath.row;
  28.  
  29. // Assign our own background image for the cell
  30. UIImage *background = [UIImage imageNamed:@"selectedCell"];
  31. UIImageView *cellBackgroundView = [[UIImageView alloc] initWithImage:background];
  32. cellBackgroundView.image = background;
  33. mycell.selectedBackgroundView = cellBackgroundView;
  34. mycell.lblPreferred.hidden = YES;
  35.  
  36. if (mycell.selectDealerBtn.tag==btnTag) {
  37. if (selectDealer==true) {
  38. [mycell.selectDealerBtn setImage:[UIImage imageNamed:@"selectedDealer"] forState:UIControlStateNormal];
  39. [mycell.selectDealerBtn setTitle:@"Select" forState:UIControlStateNormal];
  40. mycell.selectDealerBtn.imageEdgeInsets = UIEdgeInsetsMake(6, 16, 26, 17);
  41. mycell.selectDealerBtn.titleEdgeInsets = UIEdgeInsetsMake(32,-66, 0, 10);
  42. mycell.lblPreferred.hidden = NO;
  43. }
  44. }
  45. else{
  46. [mycell.selectDealerBtn setImage:[UIImage imageNamed:@"N99-selectDealerBtn"] forState:UIControlStateNormal];
  47. [mycell.selectDealerBtn setTitle:@" " forState:UIControlStateNormal];
  48. mycell.lblPreferred.hidden = YES;
  49. }
  50.  
  51. return mycell;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement