Posts

Showing posts from August 3, 2012

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];