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

    +2

    1. 1
    2. 2
    3. 3
    4. 4
    NSString *error = [NSString stringWithFormat:@"Enter your %@%@%@", 
    											 [email length] ? @"" : @"email",
    											 [email length] || [password length] ? @"" : @" and ",
    											 [password length] ? @"" : @"password"];

    Дай дураку тернарный оператор - он и лоб расшибет.

    byss, 17 Мая 2012

    Комментарии (0)
  2. Objective C / Говнокод #10290

    +5

    1. 1
    @property (nonatomic, retain) NSString *totalCount;

    Чуть глаза от такого не лопнули

    QuickNick, 16 Мая 2012

    Комментарии (10)
  3. Objective C / Говнокод #10273

    +1

    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
    @try 
    	{
    		if ([[NSThread currentThread] isCancelled]) // Поток мог быть остановлен, пока мы где-то стояли на lock'е
    			return nil;
    
    		
    		// парсим html-строку в DOM
            viewData.body = [[viewData.body componentsSeparatedByString: @"<tab"] componentsJoinedByString: @"<b"];
            viewData.body = [[viewData.body componentsSeparatedByString: @"</tab"] componentsJoinedByString: @"</b"];
    		
    		htmlDocPtr hdoc = htmlParseDoc((xmlChar*)[[NSString stringWithFormat:@"<div>%@</div>",viewData.body] UTF8String], "utf-8");
    		xdoc = [[NSXmlDoc alloc] initWithNode:hdoc];
    		
    		if ([[NSThread currentThread] isCancelled])
    			return nil;
    
    		
    		// Собираем форматированную строку
    		blockRanges = [[NSMutableArray alloc] init];
    		xmlNodePtr node = [xdoc selectNode:@"/html/body/div"].libxmlNode; // Работа напрямую с нодами во враппере не реализованна :(
    		parsedString = [[NSMutableAttributedString alloc] init];
    		[self parseTag:node string:parsedString blockRanges:blockRanges];
    		[xdoc release];
    		xdoc = nil;
    		
            viewData.body = [[viewData.body componentsSeparatedByString: @"<b"] componentsJoinedByString: @"<tab"];
            viewData.body = [[viewData.body componentsSeparatedByString: @"</b"] componentsJoinedByString: @"</tab"];
    		
            
    		if ([[NSThread currentThread] isCancelled])
    			return nil;

    Вот такой костыль по обходу бага в html-парсере libXml.

    krypt, 15 Мая 2012

    Комментарии (0)
  4. Objective C / Говнокод #10242

    +4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    - (id)init:(NSString *)score{
        
        if (self = [super init]) {
            // Custom initialization
    		[self initWithNibName:@"Score_View" bundle:nil];
    		self.total_score=[score copy];
        }
        return self;
    }

    Отличная инициализация контроллера.

    Headless, 11 Мая 2012

    Комментарии (1)
  5. Objective C / Говнокод #10200

    −4

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    - (void)dealloc {
        LandscapeNote *tempCell;
        for (NSInteger i = 0; i < [_scrollView.subviews count]; i++) {
            tempCell = [_scrollView.subviews objectAtIndex:i];
            [tempCell removeFromSuperview];
        }
        [notesArray release];
        [self viewDidUnload];
        [super dealloc];
    }

    смотрим название метода...

    kilovata, 05 Мая 2012

    Комментарии (3)
  6. Objective C / Говнокод #10190

    +2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
     if([value objectForKey:fTimestamp] == [NSNull null]){
            objectData.Timestamp = [[value objectForKey:fTimestamp]intValue];
        }else{
            objectData.Timestamp = 0;
        }

    В зарелизинной версии проекта было.
    А я сидел и думал, почему половина полей из базы маппятся в нули в классы сущностей...

    dove06, 04 Мая 2012

    Комментарии (0)
  7. Objective C / Говнокод #10117

    +5

    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
    NSArray *beautifulValues = [[NSArray alloc] initWithObjects:
                                    [NSNumber numberWithFloat:0.00001], 
                                    [NSNumber numberWithFloat:0.00005], 
                                    [NSNumber numberWithFloat:0.0001],
                                    [NSNumber numberWithFloat:0.005],
                                    [NSNumber numberWithFloat:0.001],
                                    [NSNumber numberWithFloat:0.005],
                                    [NSNumber numberWithFloat:0.01],
                                    [NSNumber numberWithFloat:0.05], 
                                    [NSNumber numberWithFloat:0.1],
                                    [NSNumber numberWithFloat:0.5],
                                    [NSNumber numberWithFloat:1],
                                    [NSNumber numberWithFloat:5],
                                    [NSNumber numberWithFloat:10],
                                    [NSNumber numberWithFloat:50],
                                    [NSNumber numberWithFloat:100],
                                    [NSNumber numberWithFloat:500],
                                    [NSNumber numberWithFloat:1000],
                                    [NSNumber numberWithFloat:5000],
                                    [NSNumber numberWithFloat:10000],
                                    [NSNumber numberWithFloat:50000],
                                    [NSNumber numberWithFloat:100000],
                                    [NSNumber numberWithFloat:500000],
                                    [NSNumber numberWithFloat:1000000],
                                    [NSNumber numberWithFloat:5000000],
                                    [NSNumber numberWithFloat:10000000], nil];

    Нашел в одном из проектов.

    itruf, 30 Апреля 2012

    Комментарии (4)
  8. Objective C / Говнокод #10035

    +5

    1. 1
    [self.navigationItem setLeftBarButtonItem:[[[UIBarButtonItem alloc] initWithCustomView:[(TANavigationBar *)self.navigationController.navigationBar backButtonWith:[UIImage imageNamed:@"ActivityNavBackButtonBackground"] highlight:nil leftCapWidth:30.0f]] autorelease]];

    Однако, это печально :(
    И не индус вроде

    dove06, 25 Апреля 2012

    Комментарии (1)
  9. Objective C / Говнокод #9910

    +6

    1. 1
    2. 2
    3. 3
    4. 4
    - (int) getRandomValue {
        int rnd = 1000;
        return rnd;
    }

    И это было уже в предрелизе..

    mazder, 10 Апреля 2012

    Комментарии (3)
  10. Objective C / Говнокод #9859

    +6

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
    {
        NSArray* headers = [[NSArray alloc] initWithObjects:@"Friends requests",@"Suggestion friends", nil];
        return [headers objectAtIndex:section];
        [headers release];
    }

    Заставляем проц думать о вченом вопросе: "быть или не быть". И потихоньку съедаем память.

    infog, 04 Апреля 2012

    Комментарии (4)