Posts

Showing posts from August, 2012

How to create simple webservice in php using JSON

Type the following code in your notepad save it with .php extension. and now run it from your browser. <?php $con=mysql_connect("localhost","root",""); if(!$con) { die("Error"); } mysql_select_db("webservice",$con); /* Data Fetch Query [Select Query to fetch data from any table] */ $sql="Select * from webservice"; $result=mysql_query($sql); $post=array(); while($row=mysql_fetch_assoc($result)) { $post[]=$row; } print_r(json_encode($post)); ?>

Programming fox: How to set background color of navigation bar in i...

Programming fox: How to set background color of navigation bar in i... : just type the following code in - viewDidLoad method     UIView *naview=[[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];    ...

How to scroll view up on keyboard appear

you should use this code to scroll the view on keyboard appear Basically whenever you want to enter some text on the textfield a default keyboard appear over the view sometimes what happen whenever the textfield present at the bottom of screen so at that type you will not be able to visible it. Here is the way to make it visible. first of all you need to inherit the UITextFieldDelegate protocol in your .h file and after that in your code make the textfield delegate to its file owner or use this code textField.delegate= self; and override this methods s -( BOOL )textFieldShouldBeginEditing:( UITextField *)textField {     NSTimeInterval animationDuration = 0.300000011920929 ;     CGRect frame = self . view . frame ;     y =textField. frame . origin . y ;     frame. origin . y =- y ;     frame. size . height += y ;     [ UIView beginAnimations : @"ResizeForKeyboard" context : nil ];   ...

How to set background color of navigation bar in iPhone

just type the following code in - viewDidLoad method     UIView *naview=[[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];       naview.backgroundColor = [UIColor colorWithRed:112/255.f green:50/255.f blue:19/255.f alpha:255/255.f];     UILabel *titleLabel=[[UILabel alloc] initWithFrame:CGRectMake(80, 5, 200, 25)];     titleLabel.textColor=[UIColor colorWithRed:255/255.f green:255/255.f blue:215/255.f alpha:255/255.f];     [titleLabel setBackgroundColor:[UIColor clearColor]];     titleLabel.text=@"title";     [naview addSubview:titleLabel];     [self.navigationController.navigationBar addSubview:naview];