- 1
- 2
- 3
- 4
NSString *error = [NSString stringWithFormat:@"Enter your %@%@%@",
[email length] ? @"" : @"email",
[email length] || [password length] ? @"" : @" and ",
[password length] ? @"" : @"password"];
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+2
NSString *error = [NSString stringWithFormat:@"Enter your %@%@%@",
[email length] ? @"" : @"email",
[email length] || [password length] ? @"" : @" and ",
[password length] ? @"" : @"password"];
Дай дураку тернарный оператор - он и лоб расшибет.
+5
@property (nonatomic, retain) NSString *totalCount;
Чуть глаза от такого не лопнули
+1
@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.
+4
- (id)init:(NSString *)score{
if (self = [super init]) {
// Custom initialization
[self initWithNibName:@"Score_View" bundle:nil];
self.total_score=[score copy];
}
return self;
}
Отличная инициализация контроллера.
−4
- (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];
}
смотрим название метода...
+2
if([value objectForKey:fTimestamp] == [NSNull null]){
objectData.Timestamp = [[value objectForKey:fTimestamp]intValue];
}else{
objectData.Timestamp = 0;
}
В зарелизинной версии проекта было.
А я сидел и думал, почему половина полей из базы маппятся в нули в классы сущностей...
+5
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];
Нашел в одном из проектов.
+5
[self.navigationItem setLeftBarButtonItem:[[[UIBarButtonItem alloc] initWithCustomView:[(TANavigationBar *)self.navigationController.navigationBar backButtonWith:[UIImage imageNamed:@"ActivityNavBackButtonBackground"] highlight:nil leftCapWidth:30.0f]] autorelease]];
Однако, это печально :(
И не индус вроде
+6
- (int) getRandomValue {
int rnd = 1000;
return rnd;
}
И это было уже в предрелизе..
+6
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
NSArray* headers = [[NSArray alloc] initWithObjects:@"Friends requests",@"Suggestion friends", nil];
return [headers objectAtIndex:section];
[headers release];
}
Заставляем проц думать о вченом вопросе: "быть или не быть". И потихоньку съедаем память.