Created
January 30, 2012 23:47
-
-
Save gmcerveny/1707591 to your computer and use it in GitHub Desktop.
Completion block
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AMViewController.h | |
// testAnimation | |
// | |
// Created by Greg Cerveny on 1/30/12. | |
// Copyright (c) 2012 Artful Medium, LLC. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
@interface AMViewController : UIViewController | |
@property (nonatomic, strong) UILabel *myLabel; | |
@property (nonatomic, assign) NSInteger testNumber; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AMViewController.m | |
// testAnimation | |
// | |
// Created by Greg Cerveny on 1/30/12. | |
// Copyright (c) 2012 Artful Medium, LLC. All rights reserved. | |
// | |
#import "AMViewController.h" | |
@implementation AMViewController | |
@synthesize myLabel, testNumber; | |
- (void)didReceiveMemoryWarning | |
{ | |
[super didReceiveMemoryWarning]; | |
// Release any cached data, images, etc that aren't in use. | |
} | |
#pragma mark - View lifecycle | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
myLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 200, 20)]; | |
myLabel.text = @"Test!"; | |
[self.view addSubview:myLabel]; | |
self.testNumber = 100; | |
} | |
- (void)viewDidUnload | |
{ | |
[super viewDidUnload]; | |
// Release any retained subviews of the main view. | |
// e.g. self.myOutlet = nil; | |
} | |
- (void)viewWillAppear:(BOOL)animated | |
{ | |
[super viewWillAppear:animated]; | |
} | |
- (void)viewDidAppear:(BOOL)animated | |
{ | |
[super viewDidAppear:animated]; | |
[UIView animateWithDuration:1.0 | |
animations:^(void){self.myLabel.center = CGPointMake(160,230);} | |
completion:^(BOOL finished){ NSLog(@"Number is %i", self.testNumber);} | |
]; | |
} | |
- (void)viewWillDisappear:(BOOL)animated | |
{ | |
[super viewWillDisappear:animated]; | |
} | |
- (void)viewDidDisappear:(BOOL)animated | |
{ | |
[super viewDidDisappear:animated]; | |
} | |
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation | |
{ | |
// Return YES for supported orientations | |
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment