I’ve copied the code below so that I have a reference to it as well.
You also need to ensure the following steps are followed…
Make your controller implement UITextViewDelegate
setup your textfield’s (s) delegate to be your controller
in the controller @interface add an int verticalOffset
in the controller @implementation add the functions below
#pragma mark "-- text editing support --"
// Animate the entire view up or down, to prevent the keyboard from covering the text field.
- (void)moveView:(int)offset {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
// Make changes to the view's frame inside the animation block. They will be animated instead
// of taking place immediately.
CGRect rect = self.view.frame;
rect.origin.y -= offset;
rect.size.height += offset;
self.view.frame = rect;
[UIView commitAnimations];
}
- (BOOL)textFieldShouldReturn:(UITextField *) sender {
[sender resignFirstResponder];
if (verticalOffset!=0) {
[self moveView: -verticalOffset];
verticalOffset = 0;
}
return TRUE;
}
- (void)textFieldDidBeginEditing:(UITextField *)theTextField {
int wantedOffset = theTextField.frame.origin.y-200;
if ( wantedOffset < 0 ) {
wantedOffset = 0;
}
if ( wantedOffset != verticalOffset ) {
[self moveView: wantedOffset - verticalOffset];
verticalOffset = wantedOffset;
}
}
I was getting problems displaying an action sheet in a view that was contained within a tab control.
UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"Are you sure you wish to continue?"
delegate:self
cancelButtonTitle:@"No"
destructiveButtonTitle:@"Yes"
otherButtonTitles:nil];
[sheet showInView:self.view];
[sheet release];
The prompt would be displayed but the clicking of the “No” button didn’t always work. The problem is although there is a view that can display the prompt, the correct view to do it is the tab bar, The following code works fine
UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"Are you sure you wish to continue?"
delegate:self
cancelButtonTitle:@"No"
destructiveButtonTitle:@"Yes"
otherButtonTitles:nil];
[sheet showFromTabBar:self.tabBarController.tabBar];
[sheet release];
This Firefox add-on allows you to view the data you are running against while using the iPhone simulator. Your sqlite files can be found in the following folder
In order to move the cursor automatically to the next data entry field when the user presses Next on the keyboard you need to resignFirstResponder from the current field and assign it to the next field using becomeFirstResponder
If you’ve updated your development phones to have the latest OS, 3.0.1, then you won’t be able to load you apps onto the device without first following this apple advisory
2. Copy and paste the following line into Terminal:
But theres a catch, if you copy the text they have from the document into Terminal there is an extra space created before the second “Developer” path, remove that and all should be ok.
When you alter your underlying data model the iPhone simulator will not be able to load your app as the cached version of the database doesn’t match the new one. The easiest way to resolve the problem is to run the simulator, click and hold your app and remove it like you would remove an app from your actual phone.