1. Objective C / Говнокод #15858

    −413

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    Partner *partnerLeft = partnerArrayForSection[(indexPath.row * 2 )];
            NSString *logoUrlLeft = [partnerLeft.logo stringByReplacingOccurrencesOfString:@"big_thumb" withString:@"original"];
            
            [cell.leftCompanyButton setTitle:partnerLeft.url forState:UIControlStateDisabled];
            [cell.leftCompanyButton addTarget:self action:@selector(companyTapped:) forControlEvents:UIControlEventTouchUpInside];
            
            cell.leftCompanyButton.imageView.contentMode = UIViewContentModeScaleAspectFit;
            [cell.leftCompanyButton setImageWithURL:[NSURL URLWithString:URLStringForPath(logoUrlLeft)]
                                                                forState:UIControlStateNormal
                                                 placeholderImage:nil];
            
            if ((indexPath.row * 2 + 1) < [partnerArrayForSection count]) {
                Partner *partnerRight = partnerArrayForSection[(indexPath.row * 2 ) + 1];
                NSString *logoUrlRight = [partnerRight.logo stringByReplacingOccurrencesOfString:@"big_thumb" withString:@"original"];
                
                [cell.rightCompanyButton setTitle:partnerRight.url forState:UIControlStateDisabled];
                [cell.rightCompanyButton addTarget:self action:@selector(companyTapped:) forControlEvents:UIControlEventTouchUpInside];
                
                cell.rightCompanyButton.imageView.contentMode = UIViewContentModeScaleAspectFit;
                [cell.rightCompanyButton setImageWithURL:[NSURL URLWithString:URLStringForPath(logoUrlRight)]
                                                                      forState:UIControlStateNormal
                                                       placeholderImage:nil];
            }
            
            return cell;
        }
    }
    
    
    -(void)companyTapped:(id)sender
    {
        WebViewController *webViewController = [[UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil] instantiateViewControllerWithIdentifier:@"WebViewController"];
    
        [self.navigationController pushViewController:webViewController animated:YES];
        [webViewController loadPageWithURL:[(UIButton *)sender titleForState:UIControlStateDisabled]];
    }

    Вот что бывает, когда на ячейке две кнопки, в таблице куча секций, а про CollectionView человек не знает

    Запостил: Vonopts, 28 Апреля 2014

    Комментарии (1) RSS

    Добавить комментарий