I’ve been quiet for a while. Having my time dedicated to iPhone app development. Today’s blog not about code yet.
Found my pictures during Webmaster gathering last time in KL. Noted, Falah was also there.



See more at edwardkhoo.
I code, I experienced, I blog and I share my enthusiasm
I’ve been quiet for a while. Having my time dedicated to iPhone app development. Today’s blog not about code yet.
Found my pictures during Webmaster gathering last time in KL. Noted, Falah was also there.



See more at edwardkhoo.
My family wanted me to find another job while still hooked with my current’s. For many moons, I’ve been able to slip away with excuses but this time, the forces are strong…and I had foreseen that I will have to deal with this. I’m gathering pros & cons, “if”, cause & effect, reasons…etc.
Don’t ditch your family (Malay)
Last time, my bill goes up over the roof and into the pond.. :p because the iPhone was intelligent enough to figure out the setting for the Edge APN,Username, etc. I found somewhere on the internet to stop this by entering any incorrect information in it.
However, a couple of days ago, I accidentally accept an update on iPhone carrier setting which removed the configuration page. (the page reside under Settings > General > Network > Cellular Data Network). The removal of the config page allow me to to have an internet connection, which I don’t want because I haven’t subscribe to any package, thus the rate would be insane. (I think, this carrier update is applied to Maxis subscriber only since Maxis has launch its iPhone 3G).
I found a way to revert back to re-appear the config page:
Reference:

Reset or some called it “revirginize” is putting the Leopard to state where it’s first bought/installed, where you would see welcome screen/video and setup/customize your Mac OS X Leopard installation.
1. Enter “Single User Mode” – (press Command-S during startup)
2. Check file system:
$ /sbin/fsck -fy
3. Mount root partition as writable:
$ /sbin/mount -uw /
4. Remove file .AppleSetupDone (hidden file):
$ rm /var/db/.AppleSetupDone
5. Remove user(s)
$ launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist $ dscl . -delete /Users/{username}
6. Remove user(s) Home directories:
$ rm -rf /Users/{username}
7. Reboot
I think the option 4 is the key procedure here that make the installation reset to its initial state.
Sources:


I thought there was an easy way such as enabling it in IB but seem I had to go to Google to find out how. For those who want to know how, here’s the original source.
Mainly, the codes involve on delegate functions:
- (void)textFieldDidBeginEditing:(UITextField *)textField
- (void)textFieldDidEndEditing:(UITextField *)textField
So, here’s the codes
1 2 3 4 5 | static const CGFloat KEYBOARD_ANIMATION_DURATION = 0.3; static const CGFloat MINIMUM_SCROLL_FRACTION = 0.2; static const CGFloat MAXIMUM_SCROLL_FRACTION = 0.8; static const CGFloat PORTRAIT_KEYBOARD_HEIGHT = 216; static const CGFloat LANDSCAPE_KEYBOARD_HEIGHT = 140; |
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 | - (void)textFieldDidBeginEditing:(UITextField *)textField { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationBeginsFromCurrentState:YES]; // the setAnimationBeginsFromCurrentState allow smooth transition // to new text field if the user taps on another [UIView setAnimationDuration:0.3]; CGRect textFieldRect = [self.view.window convertRect:textField.bounds fromView:textField]; CGRect viewRect = [self.view.window convertRect:self.view.bounds fromView:self.view]; CGFloat midline = textFieldRect.origin.y + 0.5 * textFieldRect.size.height; // find the midline of textfield CGFloat numerator = midline - viewRect.origin.y - MINIMUM_SCROLL_FRACTION * viewRect.size.height; CGFloat denominator = (MAXIMUM_SCROLL_FRACTION - MINIMUM_SCROLL_FRACTION) * viewRect.size.height; CGFloat heightFraction = numerator / denominator; if (heightFraction < 0.0) { heightFraction = 0.0; } else if (heightFraction > 1.0) { heightFraction = 1.0; } animatedDistance = floor(PORTRAIT_KEYBOARD_HEIGHT*heightFraction); self.view.frame = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y-animatedDistance, self.view.frame.size.width, self.view.frame.size.height); [UIView commitAnimations]; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 | - (void)textFieldDidEndEditing:(UITextField *)textField { CGRect viewFrame = self.view.frame; viewFrame.origin.y += animatedDistance; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationBeginsFromCurrentState:YES]; [UIView setAnimationDuration:KEYBOARD_ANIMATION_DURATION]; [self.view setFrame:viewFrame]; [UIView commitAnimations]; } |
However, you could also refer to UICatalog example which also has example quite similar to this one but I prefer this one.
I’ve found 2 ways, currently, on how to hide keyboard when textfield lost focus on when user has done editing.
Did End On Exit1 2 3 4 | - (BOOL)textFieldShouldReturn:(UITextField *)textField { [textField resignFirstResponder]; return YES; } |
Very simple indeed. Just add this function in view where you want textfield to be delegated to.
Outlines:
-(IBAction)endEditing:(id)sender;References:
There’s no radio button in XCode for iPhone. Following good design practices, if you have 3 or 4 options, it is good to show it all rather than putting in drop down menu. It it is on web application, you can do it as radio button but if for application in iPhone, there is no radio button. However, there’s UISegmentedControl that function as in radio button.

Radio Button for Web App on iPhone

UISegmentedControl
Now, have to convert all algorithm from javascript to objective-c for iphone app. However, I want to test it, rather on iphone simulator, on real iphone but there’s other restrictions to it… “Code Signing”, “IDP (IPhone Developer Program). I did found the workaround but didn’t try yet.
What you need:
Here’s the link for detailed instructions. Better read there coz I don’t applied it yet. You’ll need to read about Code Signing Identify.
Here is another reference but seemed to not work but I think it just missed steps. The other steps is good for reference.
Found that there’s no easy way of creating radio button alike field as in web app for iPhone. In native iPhone app development, need to either use the UISegmentedControl or using UITableView with the items as cell and set the checkmark accessory type when user selects a cell.
These are some of the forum that I referred to:
If you like to use the checkbox style, you’d should look at the example from Apple Developer Connection (ADC), Accessory. You need to have access to ADC to be able to download.
In some thread in MacRumors, a member there pointed out that if you’ve 3-8 items, then UISegmentControl is a good replacement for radio buttons but for a larger number of items, UIPickerView is better. I have a small number of items thus UISegmentControl is of my choice. Hmm… let see what will happens.
Development status:
I’m doing native app development of oncoPDA version right now. My time is squeezed onto learning and developing at the same time but thank goodness that I have past experiences with development of Cocoa application in Objective-C language.
For web iphone version of oncology application, you can visit http://oncopda.com. If you’re developing web app for iphone, you could:
Just the sake of putting image into my blog :p, this is my iPhone simulator and XCode on my Mac. Still long way to go…

These 2 days, I’ve been working on customizing 7 very simple web app to have look and feel in iphone. For that to accomplished, I’ve do some digging on webkit css, javascript and html. For the time being, I present to you the screen shot of the web app in iPhone.
I’ll post the details later. Currently so tired for being awake till morning for two days.
Anyway, the app is for medical assistance and the original can be viewed at http://palmdoc.net/oncopda. The iPhone version also will be uploaded there (subjected to discussion)