Dec
31
2009
While re-writing Tally Up, I wanted to flex some Core Animation code, and came up with a split-screen design, where the toolbar is in the middle, the people list is on top, and the expense list is on the bottom. The first challenge with this design is that I want the list on the top to fill up from the bottom — not the top down. So with some advice from Matt Gallagher I whipped up a custom UIView and -(void)layoutSubviews, and sure enough, 20 minutes and 1 loop later, my people populate from the bottom Up!
- Step 1: Customize UITableView
@implementation KSBottomUpTableView
- (void)layoutSubviews {
[super layoutSubviews];
double start = self.frame.size.height;
for (UIView* child in [self subviews]) {
CGRect f = child.frame;
if ([child isKindOfClass:[UITableViewCell class]]) {
f.origin.y = start = start - f.size.height;
child.frame = f;
}
}
}
- Step 2: Plug into IB
Quick change of the class name in Interface Builder

- Step 3: Build and Test
It works!

A few observations that surprised me:
- There were no UITableViewCells in the table prior to
[super layoutSubviews]
It seems very strange to me that a routine named layout creates the subviews, but I’m sure there’s a reason. One bigger question that I do have however, is where in the event loop are the UITableCellView’s removed since every time layoutSubviews is called, it has no cells!
- There are 2 UIImageView objects that are always children of the UITableView.
I’m guessing these are something to do with the scroll bar? The frame was (0 0; 7 7) and (0 -230; 7 7);
- Next Steps for KSBottomUpTableView
- Create empty rows on top
- Overflow the table on the top, not the bottom
That’s all! Tally Up has been stalled for far too long. It’s great to have a simple little app get some use! But I need to get an update out so I can bang out some of my other projects that are hatching. Also, now that I have a blog up that I’m somewhat happy with, I’m going to focus more on using the blogging tool chain more.
PS: If anyone knows how to make the code block not lose it’s formating in WordPress that would be awesome.
no comments | tags: Tally Up | posted in Tally Up
Oct
10
2008
So It looks like 2/5’s of my downloads are from outside of the US, and the majority of my initial comments are Internationalization related. So, I looked to internationalize, and it is as easy as it should be! But most of the Documentation is Reference based, not examples. And well, I much prefer to steal and refactor examples than to understand and learn, so I put these forth for future Internationalization people to steal from!
This Document Is the official documentation for Internationalization. Good, dry reading.
These 3 steps are all I needed to do:
1) Convert XIB files:
- Internationalize XIB files. Select the XIB file in XCode, click the info button, and under general press ‘Make Localized’
- Extract strings: ibtool -L MainWindow.xib > ./MainWindow.strings
- Translate: See Post below!
- Re-create new XIB File:ibtool -d de.lproj/MainMenu.strings English.lproj/MainMenu.nib -W French.lproj/MainMenu.nib
2) Use NSLocalizedString wherever you have a user-visible string to display
- Modify Code to use NSLocalizedString
- Generate a Localized.strings file auto-matically with: genstrings -o t1 *.m
This tool is very cool, it actually parses your code and looks for where you use NSLocalizedString and it generates your key/value pairs from the code!
- Translate and copy Localized.strings into the .lproj directories
3) Use the Localized interfaces on any API objects you have.
- For me, the only object was the NSNumberConverter. I was using a direct number converter, and I realized that it took care of things for all locales even easier!
formatter = [[NSNumberFormatter alloc] init];
[formatter setNumberStyle:NSNumberFormatterCurrencyStyle];
[formatter setLocale:[NSLocale currentLocale]];
I applaud Apple in their toolchain. It’s great that I can develop great user-friendly Apps in a developer-friendly environment!
Anyone else have any Internationalization Tips?
5 comments | posted in Tally Up
Oct
10
2008
Hi,
If you would like Tally Up to be localized for your language, please translate the following strings and post below! This is one problem that I never really thought I’d have to tackle, but almost 2/5ths of downloads are coming from outside the US!
That’s a cool problem in my book!
Actions
Active Tallies
Name
Cost
Split By
Paid By
Expense Totals
Specify People
Create New Expense
Current Expenses
No Expenses
Tally Summary
Send Tally
Email Tally Summary
Add Person to Tally
People in Tally
No People Specified
Quick Add
Name or Initials
From Contacts
Nobody
Required
Must Enter Cost
The following I want to put some context around since a direct translation may not work:
<Name> owes <Amount>
<Name> is owed <Amount>
<Amount> for <Expense Name>
<Name> is out
Thanks for your help.
6 comments | posted in Tally Up
Sep
17
2008
After a fair deal of wrestling with the submission process, Tally Up has been submitted to the App store. I hope that some people discover it and find it useful!
Many Thanks to:
David Russell
Steve Beckwith
Jamie Sutton
31 comments | posted in Tally Up