1. You can do this with blocks!
You can pass some block to BottomView.
2. Or you can do this with a targeted action.
you can go to the BottomView selector @selector @selector(myMethod:) as an action, and a pointer to the view controller as the target. And after the animation finishes, use the performeSelector: method.
3. Or you can define @protocol delegation and implement methods in your viewController, and add the delegate property to the BottomView. @property (assign) delegate id;
If you do some animations in your BottomView, you can use UIView
animateWithDuration:delay:options:animations:completion:
which 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 the animation you need to call [self notifyDelegateAboutAnimationDone];
you must set the ViewController class to validate the BottomViewDelegate protocol
in MyViewController.h
@interface MyViewController : UIViewController <BottomViewDelegate> ... @end
and fe in viewDidLoad you should set bottomView.delegate = self;
Bergp source share