1.You can do it with blocks!
You can pass some block to BottomView.
2. Or you can do it with target-action.
you can pass to BottomView selector @selector(myMethod:) as action, and pointer to the view controller as target. And after animation ends use performeSelector: method.
3. Or you can define delegate @protocol and implement methods in your viewController, and add delegate property in BottomView. @property (assign) id delegate;
If you make some animations in your BottomView, you can use UIView method
animateWithDuration:delay:options:animations:completion:
that uses blocks as callbacks
[UIView animateWithDuration:1.0f animations:^{ }];
update:
in ButtomView.h
@class BottomView; @protocol BottomViewDelegate <NSObject> - (void)bottomViewAnimationDone:(BottomView *) bottomView; @end @interface BottomView : UIView @property (nonatomic, assign) id <BottomViewDelegate> delegate; ..... @end
in ButtomView.m
- (void)notifyDelegateAboutAnimationDone { if ([self.delegate respondsToSelector:@selector(bottomViewAnimationDone:)]) { [self.delegate bottomViewAnimationDone:self]; } }
and after animation complit you should call [self notifyDelegateAboutAnimationDone];
you should set you ViewController class to confirm to protocol BottomViewDelegate
in MyViewController.h
@interface MyViewController : UIViewController <BottomViewDelegate> ... @end
and f.e. in viewDidLoad you should set bottomView.delegate = self;