Thursday, May 31, 2012

iOS-- Managing Subviews


1. Adding Subviews

  •  insertSubview:atIndex:
  •  insertSubview:aboveSubview:
  •  insertSubview:belowSubview:



2. Reordering and Removing Subviews

  • Use [parentView exchangeSubviewAtIndex:i withSubviewAtIndex:j] to exchange the positions of two views.
  • Move subviews to the front or back using bringSubviewToFront: and 
  • sendSubviewToBack.
  • To remove a subview from its parent, call [childView removeFromSuperview]. If 
  • the child view had been onscreen, it disappears. Removing a child from the superview 
  • calls a release on the subview, allowing its memory to be freed if its retain
  • count has returned to 0.

3. View Callback

  •  didAddSubview: is sent to a view after a successful invocation of addSubview: lets subclasses of UIView perform additional actions when new views are added.
  • didMoveToSuperview: informs views that they’ve been re-parented to a new superview. The view may want to respond to that new parent in some way.When the view was removed from its superview, the new parent is nil.
  • willMoveToSuperview: is sent before the move occurs.
  • didMoveToWindow: provides the callback equivalent of didMoveToSuperview but when the view moves to a new Window hierarchy instead of to just a new superview.
  • willMoveToWindow: is, again, sent before the move occurs.
  • willRemoveSubview: informs the parent view that the child view is about to be removed.

Wednesday, May 30, 2012

iOS-- URL encode


1. First method




2.Second method




Tuesday, May 29, 2012

iOS-- Convert string to date


To convert a string to date format
if the string format is like "22/05/2012 9:58:33 AM"

code:





Monday, May 28, 2012

iOS - Performing Runtime Compatibility Checks


  • Check platform geometry   
      if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)




  • Check deployment platform  
      if ([[UIDevice currentDevice].model isEqualToString:@"iPad"]) 




  •   Check system prefix       
       if ([[[UIDevice currentDevice] systemVersion] hasPrefix:@"5."])    




  •  Check for properties using key-value coding    
       UILabel *label = (UILabel *)[cell valueForKey:@"textLabel"];
       if (label) [label setText:celltext]; 



  •   Check for class existence    
               if (NSClassFromString(@"NSAttributedString")) . . .



  •  Check for function existence       
       if(&UIGraphicsBeginImageContextWithOptions != NULL) . . .



  •   Check for selector compliance    
        if ([cell respondsToSelector:@selector(selectorName:)])    

Sunday, May 27, 2012

IOS -- INTRODUCING BLOCK



1. What is block


     A block is an anonymous inline collection of code that:
  • Has a typed argument list just like a function
  • Has an inferred or declared return type
  • Can capture state from the lexical scope within which it is defined
  • Can optionally modify the state of the lexical scope
  • Can share the potential for modification with other blocks defined within the same lexical scope
  • Can continue to share and modify state defined within the lexical scope (the stack frame) after the lexical scope (the stack frame) has been destroyed

2. Declare and using block








image: ../Art/blocks.jpg








3. __block modifier


   __block variables live in storage that is shared between the lexical scope of the variable and all blocks and   block copies declared or created within the variable’s lexical scope. 





Thursday, May 24, 2012

Change iOS app specific store in iTunes Connect

To change where your app will be sold.

1. Go to Rights and Price


2. Select "Specific Stores"



3. Choose the country you want your app sell and save


Thursday, May 3, 2012

SQL tip


Nice article. simple and easy to understand

RAID and Its impact on your SQL performance