Субъективный Си / Говнокод #23079 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
NSString *categoryString;

for (Model *categoryItem in arrayCategory) {
        if (categoryItem.isCheck) {
            if (categoryString == nil) {
                categoryString = [NSString stringWithFormat:@"%@", categoryItem.id];
            } else {
                categoryString = [NSString stringWithFormat:@"%@,%@", categoryString, categoryItem.id];
            }
        }
    }

kyzmitch kyzmitch, (Updated )

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

Субъективный Си / Говнокод #23034 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
NSString *userName = @"username";
  self.wscSession = [[[[[[[[[[[[WSCSessionBuilder create:urlString]
                                             withConnectionDelegate:WSCSessionConnectionDelegate]
                                           withUserName:userName]
                                         withObserverDelegate:WSCSessionConnectionObserverDelegate]
                                       withPackage:[[WSCCallPackage alloc] init]]
                                     withHttpContext:httpContext]
                                   withIceServerConfig:iceServerConfig]
                                 build];
  // Open a connection to the server...
  [self.wscSession open];

https://docs.oracle.com/cd/E55119_01/doc.71/e55126/wd_iosapps.htm#WSEWD548

Оракл умеет в скобочки

P.S. Зато они сделали SIP+WS+WebRTC

Desktop Desktop, (Updated )

Комментарии (23, +23)

Субъективный Си / Говнокод #22108 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
- (NSString*) SHA256 {
    const char *cStr = [self UTF8String];
    unsigned char result[CC_SHA256_DIGEST_LENGTH];
    CC_SHA256(cStr, strlen(cStr), result);
    NSString *s = [NSString  stringWithFormat:
                   @"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",
                   result[0], result[1], result[2], result[3], result[4],
                   result[5], result[6], result[7],
                   result[8], result[9], result[10], result[11], result[12],
                   result[13], result[14], result[15],
                   result[16], result[17], result[18], result[19],
                   result[20], result[21], result[22], result[23], result[24],
                   result[25], result[26], result[27],
                   result[28], result[29], result[30], result[31]
                   ];
    return [s lowercaseString];
}

Обнаружено на самом дне

vGamBIT vGamBIT, (Updated )

Комментарии (3, +3)

Субъективный Си / Говнокод #20849 Ссылка на оригинал

0

  1. 1
~Тред о пользе багра~

Действительно, багор - очень полезная вещь. Багром можно поковыряться в жопе, чтобы извлечь застрявший обломок чьего-то члена. Помни о пользе багра.

Anal_teacher Anal_teacher, (Updated )

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

Субъективный Си / Говнокод #19723 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
    
    //cell.textLabel.font = [UIFont fontWithName:@"Arial" size:10.0f];
    
    if([indexPath row] == ((NSIndexPath*)[[tableView indexPathsForVisibleRows] lastObject]).row)
    {
        CGSize iOSDeviceScreenSize = [[UIScreen mainScreen] bounds].size;
        if (iOSDeviceScreenSize.height < 568)
        {
            CGRect newFrame = tableView.frame;
            newFrame.size.height=iOSDeviceScreenSize.height;
            tableView.frame=newFrame;
        }
    }
}

Autolayout своими руками

bdevnameless bdevnameless, (Updated )

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

Субъективный Си / Говнокод #19580 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  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
+ (UIView *) createTextField:(NSString *)placeholder {
	UIView * view = [UIView new];
    view.frame = CGRectMake(0, 0, 100, 50);
    view.autoresizesSubviews = YES;
    view.backgroundColor = [UIColor whiteColor];
    view.layer.borderWidth = 0.5;
    view.layer.borderColor = COLOR(204, 204, 204).CGColor;
    view.layer.cornerRadius = 5;
    view.exclusiveTouch = YES;
    
    UITextField * testField = [UITextField new];
    testField.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    testField.textColor = [UIColor blackColor];
    testField.borderStyle = UITextBorderStyleNone;
    testField.autocorrectionType = UITextAutocorrectionTypeNo;
    [view addSubview:testField];

   return view;
}

Потом у нас есть какойто контроллер

- (void)viewDidLoad {
    [super viewDidLoad];

    textField = [[MyClass createTextField:@"CITY, STATE OR ZIP"] subviews][0];
    textField.returnKeyType = UIReturnKeySearch;
    textField.delegate = (id<UITextFieldDelegate>)self;
    [self.view addSubview:textField.superview];
}

На iOS 8.4 на устройстве текстфилд не будет отображаться
Нужно делать так:

UIView * v = [MyClass createTextField:@"CITY, STATE OR ZIP"];
textField = [v subviews][0];
[self.view addSubview:textField.superview];

COCOK-MAMOHTA COCOK-MAMOHTA, (Updated )

Комментарии (14, +14)