0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
@try {
NSMutableArray *items = nil;
if(isGrouped){
items = [NSMutableArray arrayWithArray:[_sortedItemsDict objectForKey:[_alphabet objectAtIndex:section]]];
}else{
items = _itemsArray;
}
[cell.textLabel setText:[[items objectAtIndex:row] name]?[[items objectAtIndex:row] name]:@"No Title"];
if([[items objectAtIndex:row] isKindOfClass:[Song class]]){
Song *song = (Song*)[items objectAtIndex:row];
[cell.detailTextLabel setText:[NSString stringWithFormat:@"%@ %@", [song albumName]?[song albumName]:[NSString string], [song artistName]]?[song artistName]:[NSString string]];
if([song isAvailableAtItunes])
NSLog(@"%@ %d", [song name], [song ID]);
[cell setTag:[song ID]];
}else if([[items objectAtIndex:row] isKindOfClass:[Album class]]){
[cell.detailTextLabel setText:[NSString stringWithFormat:@"%@", [[items objectAtIndex:row] artistName]]?[[items objectAtIndex:row] artistName]:[NSString string]];
}else if([[items objectAtIndex:row] isKindOfClass:[Podcast class]] || [[items objectAtIndex:row] isKindOfClass:[Audiobook class]]){
[cell setTag:[[items objectAtIndex:row]ID]];
}
if(!isFromSelfLibrary){
if(items && ([[items objectAtIndex:row] isKindOfClass:[Song class]] || [[items objectAtIndex:row] isKindOfClass:[Podcast class]] || [[items objectAtIndex:row] isKindOfClass:[Audiobook class]])){
if([[items objectAtIndex:row]isAvailableAtItunes]){
for(UIView *view in [cell subviews]){
if(view.tag == 111){
[view setHidden:NO];
}
}
}else{
[[DataController instance] checkItem:[items objectAtIndex:row]];
}
[cellsDict setValue:cell forKey:[NSString stringWithFormat:@"%d",[cell tag]]];
}
}
if(items && ![[items objectAtIndex:row] isKindOfClass:[Song class]]
&& ![[items objectAtIndex:row] isKindOfClass:[Podcast class]]
&& ![[items objectAtIndex:row] isKindOfClass:[Audiobook class]])
{
[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
}
[cell.textLabel setTextColor:[UIColor whiteColor]];
[cell.textLabel setShadowColor:[UIColor blackColor]];
[cell.textLabel setShadowOffset:CGSizeMake(0, 1)];
[cell.detailTextLabel setTextColor:[UIColor lightGrayColor]];
[cell.detailTextLabel setShadowOffset:CGSizeMake(0, 1)];
[cell.detailTextLabel setShadowColor:[UIColor blackColor]];
[tableView deselectRowAtIndexPath: indexPath animated: YES];
}
@catch (NSException *exception) {
NSLog(@"olo1");
}
Не то, чтобы отлов исключения меня печалит.... :'(
Запостил:
lime ,
08.12.2011 (Updated 25.03.2018 )
Комментарии (7) RSS