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

    −81

    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
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    - (void)setCategory:(NSDictionary *)newCategory
    {
    	id category = [newCategory retain];
    	[_category release];
    	_category = category;
    	if(_category != nil) {
    		NSString *categoryID = GetString([_category objectForKey:@"id"]);
    		const CategoryViewData *data = FindCategoryViewData(categoryID);
    		if(data == NULL)
    			goto _clearView;
    
    		UIImage *buttonImage = [UIImage imageNamed:GetCategoryIconName(categoryID)];
    		[_titleButton setImage:buttonImage forState:UIControlStateNormal];
    		NSString *buttonTitle = [NSString stringWithFormat:@"  %@ ➤", data->buttonTitle];
    		[_titleButton setTitle:buttonTitle forState:UIControlStateNormal];
    		UIImage *buttonColorImage = [UIImage imageNamed:buttonColorImageName];
    		[_titleButton setTitleColor:[UIColor colorWithPatternImage:buttonColorImage] forState:UIControlStateNormal];
    		
    		_pageControl.onImage = [UIImage imageNamed:data->pageControlOnImageName];
    		_pageControl.currentPage = 0;
    		_pageControl.numberOfPages = numberOfPages;
    		
    		_allVideosLabel.text = [NSString stringWithFormat:@"Все %@", data->allVideosTitle];
    		
    		[self adjustVideoViews];
    	}
    	else {
    _clearView:
    		[_titleButton setImage:nil forState:UIControlStateNormal];
    		[_titleButton setTitle:nil forState:UIControlStateNormal];
    		[_titleButton setTitleColor:nil forState:UIControlStateNormal];
    		
    		_pageControl.onImage = nil;
    		_pageControl.currentPage = 0;
    		_pageControl.numberOfPages = 0;
    		
    		_allVideosLabel.text = nil;
    
    		for(CategoryRowCell *cell in _videoViews) {
    			[cell removeFromSuperview];
    		}
    		self.videoViews = nil;
    		_scrollView.contentSize = CGSizeZero;
    		_scrollView.contentOffset = CGPointZero;
    		_allVideosView.frame = CGRectMake(0, 0, CGRectGetWidth(_allVideosView.frame), CGRectGetHeight(_allVideosView.frame));
    		_allVideosView.hidden = YES;
    	}
    }

    Типичная ячейка

    ArtFeel, 03 Июня 2013

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

    −117

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    [storeButton performSelectorInBackground:@selector(onTouchUp) withObject:nil];
    ...
    -(void)onTouchUp{
       [self                   setHighlighted:NO];
       [self.storeNameLabel         setHighlighted:NO];
       [self.storeAddressLabel      setHighlighted:NO];
       [self.storePhoneLabel        setHighlighted:NO];
       [self.storeAddress2Label     setHighlighted:NO];
       
    }

    torip3ng, 31 Мая 2013

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

    −105

    1. 1
    if(ignoreSelection?[atml extraCharges]!=NULL:[atml extraCharges]&&![atml selectedAttribute])

    Лесенки для слабаков!!

    Psionic, 31 Мая 2013

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

    −108

    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
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    - (void) fixUIAfterRotation: (UIInterfaceOrientation) interfaceOrientation
    {
    	[self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:UIInterfaceOrientationIsPortrait(interfaceOrientation)? @"bg_new.png":@"bg_new_90.png"]]];
      	NSString *path = [[NSBundle mainBundle] bundlePath];
    	NSURL *baseURL = [NSURL fileURLWithPath:path];
    	NSString *htmlStr;
    	webError = NO;
        orient = UIInterfaceOrientationIsPortrait(interfaceOrientation)? 1:2;
        float width_ = [[UIScreen mainScreen] bounds].size.height;
        viewNews.frame = isRotation? (UIInterfaceOrientationIsPortrait(interfaceOrientation)? 
               CGRectMake(0, 0, width_, 240):CGRectMake(0, 0, width_, width_ - 90)):(UIInterfaceOrientationIsPortrait(interfaceOrientation)? CGRectMake(0, 0, 320, width_ - 81):CGRectMake(0, 0, width_, 240));
        isRotation = isRotation? NO:isRotation;
        
    #if defined(PRO_PROJECT)    
     	if (UIInterfaceOrientationIsPortrait(interfaceOrientation))
    	{
    		htmlStr = [NSString stringWithFormat:@"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" 
                              \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\">
                               <head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><title>Untitled Document</title>
                               <style>body {margin:0px; padding:0px; font:13px arial; background:none;}
                               a {text-decoration:underline; color:#fbcf04; font-weight:bold; !important;} a:hover {text-decoration:none;}
                               .title{background:#575757 left top repeat-x; font:bold 15px Arial; color:#FFF; padding:14px 30px 0px 0px; height:31px; 
                               border-bottom:1px solid #000000; line-height:14px}.titleIm{background:#575757 left top repeat-x; padding:13px 8px 13px 13px; height:31px; 
                               border-bottom:1px solid #000000;}.news_body {border-top:1px solid #414141; padding:10px 14px 14px 14px; 
                               color:#FFF; line-height:19px; background:#3d3d3d;}.news_body p {padding-top:0px;}</style></head>
                              <body><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"320\" height=\"388\"><tr><td width=\"75\" valign=\"top\" class=\"titleIm\">
                              <img src=%@ height=\"70\" width=\"70\"></td><td valign=\"top\" class=\"title\">%@ 
                              <div style=\"font:11px Arial; color:#858585; line-height:18px;\">%@</div></td></tr><tr>
                              <td colspan=\"2\" valign=\"top\" class=\"news_body\">%@</td></tr></table></body></html>",
                               imageName, [newsDescription objectForKey:@"titleNews"], 
                               [CORENewsTitleList getDataString:[newsDescription objectForKey:@"dateNews"]], 
                               [newsDescription objectForKey:@"discriptionNews"]];
    	}
    	else
    	{
    		htmlStr = [NSString stringWithFormat:@"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" 
                              \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\">
                             <head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><title>Untitled Document</title>
                             <style>body {margin:0px; padding:0px; font:13px arial; background:none;}
                             a {text-decoration:underline; color:#fbcf04; font-weight:bold; !important;}a:hover {text-decoration:none;}
                             .title {background:#575757 left top repeat-x; font:bold 15px Arial; color:#FFF; padding:14px 30px 0px 0px; height:31px; 
                              border-bottom:1px solid #000000; line-height:14px}.titleIm {background:#575757 left top repeat-x; padding:13px 8px 13px 13px; height:31px; 
                              border-bottom:1px solid #000000;}.news_body {border-top:1px solid #414141; padding:10px 14px 14px 14px; 
                              color:#FFF; line-height:19px; background:#3d3d3d;}.news_body p {padding-top:0px;}</style></head>
                              <body><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"%f\" height=\"240\"><tr><td width=\"75\" valign=\"top\" class=\"titleIm\">
                              <img src=%@ height=\"70\" width=\"70\"></td><td valign=\"top\" class=\"title\">%@ 
                              <div style=\"font:11px Arial; color:#858585; line-height:18px;\">%@</div></td></tr><tr>
                              <td colspan=\"2\" valign=\"top\" class=\"news_body\">%@</td></tr></table></body></html>",
                              width_, imageName, [newsDescription objectForKey:@"titleNews"], 
                              [CORENewsTitleList getDataString:[newsDescription objectForKey:@"dateNews"]], 
                              [newsDescription objectForKey:@"discriptionNews"]];
    	}
    #else
        if (UIInterfaceOrientationIsPortrait(interfaceOrientation))
    	{
                    // тот же упоротый код, что и выше, за исключением цветов для бэкграунда и надписей.
            }
    	else
    	{
                    // тот же упоротый код, что и выше, за исключением цветов для бэкграунда и надписей.
    	}
    #endif
    	[viewNews loadHTMLString:htmlStr baseURL:baseURL];
    }

    Поворачиваем вебвью во вью-контроллере, который может использоваться в 2 проектах, имеющих различные темы (отличается бэкграунд и цвет надписей).

    QuickNick, 30 Мая 2013

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

    −110

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    Amount_List=[[NSArray alloc] initWithObjects:@"500",@"1000",@"2000",@"5000",@"10000",@"25000",@"50000",@"100000",@"250000",@"350000",@"500000",@"1000000",nil];
    	
    
    	//ShowWonAmout
    	NSString *str1=[NSString stringWithFormat:@"%@",[currencyStyle stringFromNumber:[NSNumber numberWithInt:[[Amount_List objectAtIndex:0] intValue]]]];
    	ShowAmount1.text=[str1 substringToIndex:[str1 length]-3];
            ...	
    	NSString *str12=[NSString stringWithFormat:@"%@",[currencyStyle stringFromNumber:[NSNumber numberWithInt:[[Amount_List objectAtIndex:11] intValue]]]];
    	ShowAmount12.text=[str12 substringToIndex:[str12 length]-3];

    Коллега принес покушать плоды трудов ребят из солнечной Индии

    clockworkman, 29 Мая 2013

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

    −80

    1. 1
    2. 2
    self.data = [[NSMutableData alloc] initWithLength:0];
    [data release];

    Indian code.
    So deep.

    ivandjeferov, 26 Мая 2013

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

    −103

    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
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    switch (btnTemp.tag) {
    		case 1:
    			if(1!=1)
    				return;
    			btnAll.selected = TRUE;
    			btnCasino.selected = FALSE;
    			btnHotel.selected = FALSE;
                btnEntertainment.selected = FALSE;
                btnGolf.selected = FALSE;
    			
    			break;
    		case 2:
    			if(1!=1)
    				return;
    			btnAll.selected = FALSE;
    			btnCasino.selected = TRUE;
    			btnHotel.selected = FALSE;
                btnEntertainment.selected = FALSE;
                btnGolf.selected = FALSE;
    			
    			break;
    		case 3:
    			if(1!=1)
    				return;
    			btnAll.selected = FALSE;
    			btnCasino.selected = FALSE;
    			btnHotel.selected = TRUE;
                btnEntertainment.selected = FALSE;
                btnGolf.selected = FALSE;
    			break;
            case 4:
    			if(1!=1)
    				return;
    			btnAll.selected = FALSE;
    			btnCasino.selected = FALSE;
                btnHotel.selected = FALSE;
       			btnEntertainment.selected = FALSE;
    			btnGolf.selected = TRUE;
    			break;
            case 5:
    			if(1!=1)
    				return;
    			btnAll.selected = FALSE;
    			btnCasino.selected = FALSE;
    			btnHotel.selected = FALSE;
                btnEntertainment.selected = TRUE;
    			btnGolf.selected = FALSE;
    			break;
    
    		default:
    			break;
    	}

    Some Indian code within a view controller.

    ivandjeferov, 26 Мая 2013

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

    −106

    1. 1
    2. 2
    3. 3
    - (FBURLConnection *)createFBURLConnection {
        return [FBURLConnection alloc];
    }

    Facebook-iOS-SDK
    Code conventions? Never heard about it.
    Всё больше убеждаюсь что в ФБ работают лютые гвоздопилы

    clockworkman, 16 Мая 2013

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

    −100

    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
    {
    	//replace common symbols...
    	[createWrapperName setStringValue:[[createWrapperName stringValue] stringByReplacingOccurrencesOfString:@"&" withString:@"and"]];
    	[createWrapperName setStringValue:[[createWrapperName stringValue] stringByReplacingOccurrencesOfString:@"!" withString:@""]];
    	[createWrapperName setStringValue:[[createWrapperName stringValue] stringByReplacingOccurrencesOfString:@"#" withString:@""]];
    	[createWrapperName setStringValue:[[createWrapperName stringValue] stringByReplacingOccurrencesOfString:@"$" withString:@""]];
    	[createWrapperName setStringValue:[[createWrapperName stringValue] stringByReplacingOccurrencesOfString:@"%" withString:@""]];
    	[createWrapperName setStringValue:[[createWrapperName stringValue] stringByReplacingOccurrencesOfString:@"^" withString:@""]];
    	[createWrapperName setStringValue:[[createWrapperName stringValue] stringByReplacingOccurrencesOfString:@"*" withString:@""]];
    	[createWrapperName setStringValue:[[createWrapperName stringValue] stringByReplacingOccurrencesOfString:@"(" withString:@""]];
    	[createWrapperName setStringValue:[[createWrapperName stringValue] stringByReplacingOccurrencesOfString:@")" withString:@""]];
    	[createWrapperName setStringValue:[[createWrapperName stringValue] stringByReplacingOccurrencesOfString:@"+" withString:@""]];
    	[createWrapperName setStringValue:[[createWrapperName stringValue] stringByReplacingOccurrencesOfString:@"=" withString:@""]];
    	[createWrapperName setStringValue:[[createWrapperName stringValue] stringByReplacingOccurrencesOfString:@"|" withString:@""]];
    	[createWrapperName setStringValue:[[createWrapperName stringValue] stringByReplacingOccurrencesOfString:@"\\" withString:@""]];
    	[createWrapperName setStringValue:[[createWrapperName stringValue] stringByReplacingOccurrencesOfString:@"?" withString:@""]];
    	[createWrapperName setStringValue:[[createWrapperName stringValue] stringByReplacingOccurrencesOfString:@">" withString:@""]];
    	[createWrapperName setStringValue:[[createWrapperName stringValue] stringByReplacingOccurrencesOfString:@"<" withString:@""]];
    	[createWrapperName setStringValue:[[createWrapperName stringValue] stringByReplacingOccurrencesOfString:@";" withString:@""]];
    	[createWrapperName setStringValue:[[createWrapperName stringValue] stringByReplacingOccurrencesOfString:@":" withString:@""]];
    	[createWrapperName setStringValue:[[createWrapperName stringValue] stringByReplacingOccurrencesOfString:@"@" withString:@""]];
    	// ...
    }

    Так-то.

    Источник: https://sourceforge.net/p/wineskin/code/ci/master/tree/Wineskin%20Winery/Wineskin_WineryAppDelegate.m

    P. S. А тулза, между прочим, нужная. Наткнулся на багу, полез фиксить. Увидев AppDelegate.m на 2700+ строк, заинтересовался, и не зря: вышеприведенное — мелочи.

    UncleAli, 03 Мая 2013

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

    −105

    1. 1
    2. 2
    [NSTimer scheduledTimerWithTimeInterval:[[NSDate distantFuture] timeIntervalSinceNow] 
                target:self selector:@selector(dummyTimer:) userInfo:self repeats:YES];

    Еще один занятный персонаж. Особенно порадовало "repeats:YES"

    mas_an, 22 Апреля 2013

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