I'm trying to learn UIKit Dynamics.
I have created a box view and added the UIGravityBehavior on it, but nothing happens when I run the Project!
Viewcontroller.m
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
    [super viewDidLoad];
    UIView* box = [[UIView alloc]initWithFrame:CGRectMake(100, 50, 100, 100)];
    box.backgroundColor = [UIColor blackColor];
    [self.view addSubview:box];
    UIGravityBehavior* gravityBehaviour = [[UIGravityBehavior alloc]init];
    [gravityBehaviour addItem:box];
    UIDynamicAnimator* myAnimator = [[UIDynamicAnimator alloc]initWithReferenceView:self.view];
    [myAnimator addBehavior:gravityBehaviour];
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
@end
This is my view controller.m file.
What is wrong in the program?
 
                        
Can you try that it works for me:
//EXTENDED
Try create instance variable in your .m file:
And in viewDidLoad create your box view and after that add:
It should sort your problem.