Adding an Everything folder name to iOS app. Kinda ugly, kinda beautiful.

This commit is contained in:
Samuel Clay 2011-11-29 18:39:52 -08:00
parent 4926105346
commit c2f16def8d

View file

@ -377,7 +377,7 @@
}
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *FeedCellIdentifier = @"FeedCellIdentifier";
FeedTableCell *cell = (FeedTableCell *)[tableView dequeueReusableCellWithIdentifier:FeedCellIdentifier];
@ -405,7 +405,7 @@
}
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *folderName = [appDelegate.dictFoldersArray objectAtIndex:indexPath.section];
NSArray *feeds = [appDelegate.dictFolders objectForKey:folderName];
NSArray *activeFolderFeeds = [self.activeFeedLocations objectForKey:folderName];
@ -428,12 +428,12 @@ didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
}
- (CGFloat)tableView:(UITableView *)tableView
heightForRowAtIndexPath:(NSIndexPath *)indexPath {
heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return kTableViewRowHeight;
}
- (UIView *)tableView:(UITableView *)tableView
viewForHeaderInSection:(NSInteger)section {
viewForHeaderInSection:(NSInteger)section {
// create the parent view that will hold header Label
UIControl* customView = [[[UIControl alloc]
initWithFrame:CGRectMake(0.0, 0.0,
@ -450,8 +450,6 @@ viewForHeaderInSection:(NSInteger)section {
[customView addSubview:borderBottom];
UILabel * headerLabel = [[UILabel alloc] initWithFrame:CGRectZero];
customView.backgroundColor = [UIColorFromRGB(0xD7DDE6)
colorWithAlphaComponent:0.8];
customView.opaque = NO;
headerLabel.backgroundColor = [UIColor clearColor];
headerLabel.opaque = NO;
@ -459,7 +457,15 @@ viewForHeaderInSection:(NSInteger)section {
headerLabel.highlightedTextColor = [UIColor whiteColor];
headerLabel.font = [UIFont boldSystemFontOfSize:11];
headerLabel.frame = CGRectMake(36.0, 1.0, 286.0, 20.0);
headerLabel.text = [[appDelegate.dictFoldersArray objectAtIndex:section] uppercaseString];
if (section == 0) {
customView.backgroundColor = [UIColorFromRGB(0xA7CDE6)
colorWithAlphaComponent:0.8];
headerLabel.text = @"EVERYTHING";
} else {
customView.backgroundColor = [UIColorFromRGB(0xD7DDE6)
colorWithAlphaComponent:0.8];
headerLabel.text = [[appDelegate.dictFoldersArray objectAtIndex:section] uppercaseString];
}
headerLabel.shadowColor = [UIColor colorWithRed:.94 green:0.94 blue:0.97 alpha:1.0];
headerLabel.shadowOffset = CGSizeMake(1.0, 1.0);
[customView addSubview:headerLabel];
@ -495,25 +501,38 @@ viewForHeaderInSection:(NSInteger)section {
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
NSString *folder = [appDelegate.dictFoldersArray objectAtIndex:section];
if ([[folder stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] length] == 0) {
return 0;
}
// NSString *folder = [appDelegate.dictFoldersArray objectAtIndex:section];
// if ([[folder stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] length] == 0) {
// return 0;
// }
return 21;
}
- (void)didSelectSectionHeader:(UIButton *)button {
NSString *folderName = [appDelegate.dictFoldersArray objectAtIndex:button.tag];
[appDelegate setActiveFolder:folderName];
appDelegate.readStories = [NSMutableArray array];
appDelegate.isRiverView = YES;
NSArray *originalFolder = [appDelegate.dictFolders objectForKey:folderName];
NSArray *activeFolderFeeds = [self.activeFeedLocations objectForKey:folderName];
NSMutableArray *feeds = [NSMutableArray array];
for (int l=0; l < [activeFolderFeeds count]; l++) {
[feeds addObject:[originalFolder objectAtIndex:[[activeFolderFeeds objectAtIndex:l] intValue]]];
if (button.tag == 0) {
[appDelegate setActiveFolder:@"Everything"];
for (NSString *folderName in self.activeFeedLocations) {
NSArray *originalFolder = [appDelegate.dictFolders objectForKey:folderName];
NSArray *folderFeeds = [self.activeFeedLocations objectForKey:folderName];
for (int l=0; l < [folderFeeds count]; l++) {
[feeds addObject:[originalFolder objectAtIndex:[[folderFeeds objectAtIndex:l] intValue]]];
}
}
} else {
NSString *folderName = [appDelegate.dictFoldersArray objectAtIndex:button.tag];
[appDelegate setActiveFolder:folderName];
NSArray *originalFolder = [appDelegate.dictFolders objectForKey:folderName];
NSArray *activeFolderFeeds = [self.activeFeedLocations objectForKey:folderName];
for (int l=0; l < [activeFolderFeeds count]; l++) {
[feeds addObject:[originalFolder objectAtIndex:[[activeFolderFeeds objectAtIndex:l] intValue]]];
}
}
appDelegate.activeFolderFeeds = feeds;