- Enable Keyboard return button for Textfield
- Enable Keyboard return button for SearchBar
- Deselect the UITableCell
- open safari from Application
- Convert NSData to NSString.
- Convert NSString to NSData
- Change UIAlertView Button Color
- To scroll the view at time of Editing textfield and keyboard appear.
- Get the Index path of table Row by UITextfield (UItextField in Table View).
Enable Keyboard return button for Textfield:
this button call following fuction default:
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
[textField resignFirstResponder];
return YES;
}
Enable Keyboard return button for SearchBar:
this button call following fuction default:
- (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar
{
searchBar.showsCancelButton = NO;
}
Deselect the UITableCell:
By Default, when we select the table cell it Become Blue so we can avoid it by
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *) newIndexPath
{
[tableView deselectRowAtIndexPath:[tableView indexPathForSelectedRow] animated:YES];
}
open safari from Application:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"Enter URL Here"]];
Convert NSData to NSString:
NSString *str = [[NSString alloc] initWithData:aData encoding:NSASCIIStringEncoding];
Convert NSString to NSData:
NSData *data = [aStr dataUsingEncoding: NSASCIIStringEncoding];
Change UIAlertView Button Color:
Create the object of UIAlertView , the call automatically following method:
- (void)willPresentAlertView:(UIAlertView *)alertView
{
[[[alertView subviews] objectAtIndex:1] setBackgroundColor:[UIColor redColor]];
/*
Here index 0 = Title , 1 = cancel Button , 2,3.... = otherButton
*/
}
To scroll the view at time of Editing textfield and keyboard appear:
just set the frame of view in textFieldDidBeginEditing such as:
self.view.frame=CGRectMake(0,-30, 320, 460);
and again set the view in textFieldDidEndEditing as:
self.view.frame=CGRectMake(0,0, 320, 460);
Get the Index path of table Row by table field such as in textFieldDidBeginEditing method:
When we use text field in UITableView.
- (void) textFieldDidBeginEditing:(UITextField *)textField
{
UITableViewCell *cell = (UITableViewCell*) [[textField superview] superview];
NSIndexPath *path = [mytable indexPathForCell:cell];
// use this path as indexpath of table fuction
}
No comments:
Post a Comment