Skip to main content

Posts

Showing posts from August, 2015

working with blocks and function which takes block as a parameter in objective c

how to create a block in objective c define a block in .h file  /*here i created a block  addPhysicsBody is the name of block ^ without is block can’t be completed  so block is defined ^addPhysicsBody typedef void (^addPhysicsBody)( CGPoint ); where void is return type and CGpoint is parameter where bolded part is a parameter taken by block 2)  step 2 @property (copy) addPhysicsBody clickBlock; add block as a property and please remember that this property is copy   because a block needs to be copied to keep track of its captured state outside of the original scope by apple  define a function in .h file that takes block as a parameter this is necessary while creating block with function  - (void)getPhysicsBody:( void (^)(CGPoint) )finishBlock; where above bolded part is block with its para...

moving from one UIViewController to another from sprite kit SKScene

create a new  NSNotificationCenter inside your  UIViewController class inside  viewDidAppear function  1). -( void )viewDidAppear:( BOOL )animated {     [[ NSNotificationCenter defaultCenter ] addObserver : self selector : @selector (disMissViewController) name : @"disMissViewController"   object : nil ]; } 2.) create selector  -( void )disMissViewController{         //in case of story board     UIStoryboard *storyboard = [ UIStoryboard storyboardWithName : @"Main"   bundle : nil ];     mainView = [storyboard instantiateViewControllerWithIdentifier : @"main" ];     //in case of code       mainView =[[ UIViewController alloc ] init ];     [ self presentViewController : newview Controller   animated : YES completion :^{              }];     //remove...