Posts

Showing posts from June, 2012

Code to Hide tab Bar

//Calling method [ self hideTabBar : self . tabBarController ]; [ self    showTabBar: self . tabBarController ]; //To Hide Tab Bar - ( void ) hideTabBar:( UITabBarController *) tabbarcontroller {                           [ UIView beginAnimations : nil context : NULL ];         [ UIView setAnimationDuration : 0.5 ];         for ( UIView *view in tabbarcontroller. view . subviews )         {             if ([view isKindOfClass :[ UITabBar class ]])             {                 [view setFrame : CGRectMake (view. frame . origin . x , 480 , view. frame . size . width , view. frame . size . height )];             }              else               {                 [view setFrame : CGRectMake (view. frame . origin . x , view. frame . origin . y , view. frame . size . width , 480 )];             }                      }                  [ UIView commitAnimations ];                           

Scroll The Content Of View

Code To Scroll The Content of View //First of all make scroll view and connect it //in .h file @property ( nonatomic , retain ) IBOutlet UIScrollView *srlView; //in .m file [ self scrollViewToCenterOfScreen : self . view ]; //Scroll the view - ( void )scrollViewToCenterOfScreen:( UIView *)theView  {     CGFloat viewCenterY = theView. center . y ;     CGRect applicationFrame = [[ UIScreen mainScreen ] applicationFrame ];     CGFloat availableHeight = applicationFrame. size . height - 250 ;  // Remove area covered by keyboard     CGFloat y = viewCenterY - availableHeight / 2.0 ;     if (y < 0 ) {         y = 0 ;     }     [ srlView setContentOffset : CGPointMake ( 0 , y) animated : YES ]; }

Custom backButton in Navigation Bar

// Make Custom back button for Navigation Bar Using static metho //In Project whenEver you want back button then write self .navigationItem.leftBarButtonItem = [CommonFunctions getBackBtn];  //in CommonFunction.h write //Method + (UIBarButtonItem *) getBackBtn; //Action + ( void )backBtnPressed; //in CommonFunction.m write + (UIBarButtonItem *) getBackBtn{     UIButton * backBtn=[UIButton buttonWithType:UIButtonTypeCustom];     [backBtn setFrame:CGRectMake( 0.0f , 0.0f , 50.0f , 28.0f )];     [backBtn setImage:[UIImage imageNamed:[NSString stringWithFormat: @"BackBtn" ]] forState:UIControlStateNormal];     [backBtn addTarget: self action: @selector (backBtnPressed) forControlEvents:UIControlEventTouchUpInside];     UIBarButtonItem *backBarButton = [[UIBarButtonItem alloc] initWithCustomView:backBtn];     return backBarButton;     } //Action For  - BackButton + ( void )backBtnPressed{     //AppDe