We're growing into something new. Read More
jtkendall

Josh Kendall  Pro


Discussion

Wrangling AppDelegates when creating custom Xcode Project Templates

I've started working on a set of Xcode project templates to make my work easier by including default code and frameworks, so far it's been pretty easy and straightforward however when I get to dealing with the App delegates I can't seem to get them to be created in a sub-folder in the app the way I want. I can get my files copied to the app in the correct sub-folder, but Xcode also generates the default AppDelegate.h and AppDelegate.m files in the app root. Every example I've looked at seems to put the files in a Classes sub-folder without creating the default files as well, it just seems like my template is missing a key line that I can't seem to figure out. Here's my template at the moment, I'm hoping someone else can point out what I'm missing. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "apple.com/DTDs/…; <plist version="1.0"> <dict> <key>Ancestors</key> <array> <string>com.apple.dt.unit.emptyApplication</string> </array> <key>Concrete</key> <true/> <key>Definitions</key> <dict> <key>Delegates/AppDelegate.h</key> <dict> <key>Group</key> <array> <string>Delegates</string> </array> <key>Path</key> <string>Delegates/AppDelegate.h</string> </dict> <key>Delegates/AppDelegate.m</key> <dict> <key>Group</key> <array> <string>Delegates</string> </array> <key>Path</key> <string>Delegates/AppDelegate.m</string> <key>TargetIndices</key> <array/> </dict> </dict> <key>Description</key> <string>This is the most basic Simple App Group template.</string> <key>Identifier</key> <string>com.simpleappgroup.basicApplication</string> <key>Kind</key> <string>Xcode.Xcode3.ProjectTemplateUnitKind</string> <key>Nodes</key> <array> <string>Delegates/AppDelegate.h</string> <string>Delegates/AppDelegate.m</string> </array> </dict> </plist> Raw Code »

Discussion

Presenting a UIViewController from a UITableViewController inside a UITabBarController inside a UINavigationController

Ok, here's the situation. I have a UITableViewController in a UITabBarController in a UINavigationController. When I click on a UITableViewCell I want the UINavigationController to push a new UIViewController onto it's stack. I'ved tried to just call: [self.navigationController pushViewController:cat animated:YES]; Raw Code » from tableView:didSelectRowAtIndexPath: Raw Code » but nothing happens. It's like the UITableViewController isn't aware of the UINavigationController's existence. Is it possible with this nesting to tell the UINavigationController to push a new UIViewController? - UINavigationController -- UITabBarController --- UITableViewController ---- UITableViewCell

Branch - Revisiting the Feed

I received a lot of feedback on my Branch - Looking at Snaps post the other day, so much so that I went back to the drawing board and started the design over. I kept general ideas from the previous version like the user info bar and modified the colors and textures of the title bar, the user info bar color and used texture to block out the areas for comments, likes and the date. So, thoughts on this version of the app compared to the last? Attached is a Question feedin both the Retina and Non-Retina versions of the simulator. Edit: Updated snap to show the snaps feed and moved the question feed to be an attachment.

Branch - Looking at Snaps

Yesterday I posted a snap showing the question feed of a iOS Forrst client I am working on, today I wanted to share a snap showing the snaps feed. It has the same style as the question & link feeds, but with (obviously) the added snap image. Edit: Added a attachment showing the color palette for the app.

    //
    //  ViewHelper.h
    //  Branch
    //
    //  Created by Joshua Kendall on 6/12/11.
    //  Copyright 2011 JoshuaKendall.com. All rights reserved.
    //

    #import <Foundation/Foundation.h>
    #import "NSDate-Utilities.h"

    @interface ViewHelper : NSObject

    + (NSString *)fuzzyTime:(NSString *)datetime;

    @end


    //
    //  ViewHelper.m
    //  Branch
    //
    //  Created by Joshua Kendall on 6/12/11.
    //  Copyright 2011 JoshuaKendall.com. All rights reserved.
    //

    #import "ViewHelper.h"

    @implementation ViewHelper

    + (NSString *)fuzzyTime:(NSString *)datetime; {
    		NSString *formatted;
    		NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease];
    		[formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    		NSTimeZone *gmt = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
        [formatter setTimeZone:gmt];
    		NSDate *date = [formatter dateFromString:datetime];
    		NSDate *today = [NSDate date];
    		NSInteger minutes = [today minutesAfterDate:date];
    		NSInteger hours = [today hoursAfterDate:date];
    		NSInteger days = [today daysAfterDate:date];
    		NSString *period;
    		if(days >= 365){
    				float years = round(days / 365) / 2.0f;
    				period = (years > 1) ? @"years" : @"year";
    				formatted = [NSString stringWithFormat:@"about %i %@ ago", years, period];
    		} else if(days < 365 && days >= 30) {
    				float months = round(days / 30) / 2.0f;
    				period = (months > 1) ? @"months" : @"month";
    				formatted = [NSString stringWithFormat:@"about %i %@ ago", months, period];
    		} else if(days < 30 && days >= 2) {
    				period = @"days";
    				formatted = [NSString stringWithFormat:@"about %i %@ ago", days, period];
    		} else if(days == 1){
    				period = @"day";
    				formatted = [NSString stringWithFormat:@"about %i %@ ago", days, period];
    		} else if(days < 1 && minutes > 60) {
    				period = (hours > 1) ? @"hours" : @"hour";
    				formatted = [NSString stringWithFormat:@"about %i %@ ago", hours, period];
    		} else {
    				period = (minutes < 60 && minutes > 1) ? @"minutes" : @"minute";
    				formatted = [NSString stringWithFormat:@"about %i %@ ago", minutes, period];
    				if(minutes < 1){
    						formatted = @"a moment ago";
    				}
    		}
    		return formatted;
    }

    @end

Converting DateTime to "Fuzzy Time" in Objective-C

This is a simple Objective-C helper class that utilizes Erica Sadun's NSDate-Extensions category to convert a DateTime into a "fuzzy" time like here on Forrst or on Twitter where it gives you "x hours ago" or "x minutes ago". I'm actually using it in my Forrst iOS client and it works pretty well (I haven't noticed any issues with it converting Forrst post dates). Using it is pretty straight-forward, include the header in the controller or model you want to use it in and then you can convert the date like so: NSString *fuzzyTime = [ViewHelper fuzzyTime:@"2011-01-31 20:10:21"]; Raw Code »

Branch - An iOS Forrst Client

Once the Forrst API was live I sat down and wrote a iOS wrapper for it and that lead me to the idea of building an iOS client since I always hate trying to login and browse the site on my iPhone. The attached image is of the Questions post feed, the other post types have the same style with the snaps having a larger area showing a preview. I'm looking for feedback on mainly the feed area and not so much on the title bar and nav as I'm quite happy with them, but any feedback is welcome. Edit: Based on feedback about the titles being cut off and my own ideas I've modified the feed area to better utilize the space. Since the area needs to grow depending on the size of the title (I'm wondering if there's a limit set on the field or if it's just a MySQL "Text" field with only it's storage limits) I moved it to the bottom of the cell since that is easier than trying to resize the cell and move items in it. I also made the like and comment icons smaller, made the date less prominent, the user's name a bit more prominent and I included their avatar. I've updated the screen shot, the original is on the left and the updated one is on the right.

Discussion

ForrstKit: An Objective-C Wrapper for the Forrst API

I spent a little bit of time this morning creating a simple Objective-C wrapper for the Forrst API using the JSON-Framework and ASIHTTPRequest. It uses NSNotificationCenter to handle data instead of returning it. All current API methods except users/auth are implemented since it's currently disabled, I did include the post/comments methods though they require authentication. I know there has been mention from some people about building Forrst apps for iOS, so hopefully this is helpful to them and others.