Newer
Older
//
// OnboardingContentViewController.h
// Onboard
//
// Created by Mike on 8/17/14.
// Copyright (c) 2014 Mike Amaral. All rights reserved.
//
#import <UIKit/UIKit.h>
@import AVKit;
NS_ASSUME_NONNULL_BEGIN
@class OnboardingViewController;
@class OnboardingContentViewController;
@protocol OnboardingContentViewControllerDelegate <NSObject>
@required
- (void)setNextPage:(OnboardingContentViewController *)contentVC;
- (void)setCurrentPage:(OnboardingContentViewController *)contentVC;
@end
extern NSString * const kOnboardMainTextAccessibilityIdentifier;
extern NSString * const kOnboardSubTextAccessibilityIdentifier;
extern NSString * const kOnboardActionButtonAccessibilityIdentifier;
extern CGFloat kDefaultImageViewSize;
typedef void (^action_callback)(OnboardingViewController *onboardController);
@interface OnboardingContentViewController : UIViewController
@property (nonatomic, weak) OnboardingViewController<OnboardingContentViewControllerDelegate> *delegate;
/**
* @brief Determines if the next page is automatically shown when the action button is pressed.
*/
@property (nonatomic) BOOL movesToNextViewController;
/**
* @brief Determines if only the inpuview will be shown.
*/
@property (nonatomic) BOOL onlyInputView;
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
/**
* @brief The image view used to show the top icon.
*/
@property (nonatomic, strong) UIImageView *iconImageView;
/**
* @brief The title label.
*/
@property (nonatomic, strong) UILabel *titleLabel;
/**
* @brief The body label.
*/
@property (nonatomic, strong) UILabel *bodyLabel;
/**
* @brief The textfield.
*/
@property (nonatomic, strong) UIView *inputView;
/**
* @brief The button used to call the action handler if one was provided.
*/
@property (nonatomic, strong) UIButton *actionButton;
/**
* @brief The width of the icon image view.
*/
@property (nonatomic) CGFloat iconWidth;
/**
* @brief The height of the icon image view.
*/
@property (nonatomic) CGFloat iconHeight;
/**
* @brief The padding between the top of the screen and the top of the icon image view.
*/
@property (nonatomic) CGFloat topPadding;
/**
* @brief The padding between the icon image view and the title label.
*/
@property (nonatomic) CGFloat underIconPadding;
/**
* @brief The padding between the title label and the body label;
*/
@property (nonatomic) CGFloat underTitlePadding;
/**
* @brief The padding between the bottom of the action button and the page control.
*/
@property (nonatomic) CGFloat bottomPadding;
/**
* @brief The padding between the bottom of the screen and the page control.
*/
@property (nonatomic) CGFloat underPageControlPadding;
/**
* @brief The block executed when the action button is pressed.
*/
@property (nonatomic, copy) action_callback buttonActionHandler;
/**
* @brief The block executed when the content view controller's viewWillAppear method is called.
*/
@property (nonatomic, copy) dispatch_block_t viewWillAppearBlock;
/**
* @brief The block executed when the content view controller's viewDidAppear method is called.
*/
@property (nonatomic, copy) dispatch_block_t viewDidAppearBlock;
/**
* @brief The block executed when the content view controller's viewWillDisappear method is called.
*/
@property (nonatomic, copy) dispatch_block_t viewWillDisappearBlock;
/**
* @brief The block executed when the content view controller's viewDidDisappear method is called.
*/
@property (nonatomic, copy) dispatch_block_t viewDidDisappearBlock;
/**
* @brief The movie player controller used to play background movies.
*/
@property (nonatomic, strong) AVPlayerViewController *moviePlayerController;
NS_ASSUME_NONNULL_END
/**
* @brief Convenience class initializer for creating an onboarding content view controller.
* @return An instance of OnboardingViewController with the provided information.
*/
+ (nonnull instancetype)contentWithTitle:(nullable NSString *)title body:(nullable NSString *)body image:(nullable UIImage *)image buttonText:(nullable NSString *)buttonText action:(nullable dispatch_block_t)action;
/**
* @brief Initializer for creating an onboarding content view controller.
* @return An instance of OnboardingViewController with the provided information.
*/
- (nonnull instancetype)initWithTitle:(nullable NSString *)title body:(nullable NSString *)body image:(nullable UIImage *)image buttonText:(nullable NSString *)buttonText action:(nullable dispatch_block_t)action;
/**
* @brief Convenience class initializer for creating an onboarding content view controller with an action_callback block.
* @return An instance of OnboardingViewController with the provided information.
*/
+ (nonnull instancetype)contentWithTitle:(nullable NSString *)title body:(nullable NSString *)body image:(nullable UIImage *)image buttonText:(nullable NSString *)buttonText actionBlock:(nullable action_callback)actionBlock;
/**
* @brief Convenience class initializer for creating an onboarding content view controller with a video.
* @return An instance of OnboardingViewController with the provided information.
*/
+ (nonnull instancetype)contentWithTitle:(nullable NSString *)title body:(nullable NSString *)body videoURL:(nullable NSURL *)videoURL inputView:(UIView *)inputView buttonText:(nullable NSString *)buttonText actionBlock:(nullable dispatch_block_t)actionBlock;
+ (nonnull instancetype)contentWithTitle:(nullable NSString *)title body:(nullable NSString *)body videoURL:(nullable NSURL *)videoURL inputView:(UIView *)inputView buttonText:(nullable NSString *)buttonText actionBlock:(nullable dispatch_block_t)actionBlock withPadding:(nonnull BOOL*)withPadding;
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
/**
* @brief Initializer for creating an onboarding content view controller with a video.
* @return An instance of OnboardingViewController with the provided information.
*/
- (nonnull instancetype)initWithTitle:(nullable NSString *)title body:(nullable NSString *)body videoURL:(nullable NSURL *)videoURL buttonText:(nullable NSString *)buttonText action:(nullable dispatch_block_t)action;
/**
* @brief Convenience class initializer for creating an onboarding content view controller with a video and an action_callback block.
* @return An instance of OnboardingViewController with the provided information.
*/
+ (nonnull instancetype)contentWithTitle:(nullable NSString *)title body:(nullable NSString *)body videoURL:(nullable NSURL *)videoURL buttonText:(nullable NSString *)buttonText actionBlock:(nullable action_callback)actionBlock;
/**
* @brief Initializer for creating an onboarding content view controller with a video and an action_callback block.
* @return An instance of OnboardingViewController with the provided information.
*/
- (nonnull instancetype)initWithTitle:(nullable NSString *)title body:(nullable NSString *)body image:(nullable UIImage *)image buttonText:(nullable NSString *)buttonText actionBlock:(nullable action_callback)actionBlock;
/**
* @brief Initializer for creating an onboarding content view controller with a video and an action_callback block.
* @return An instance of OnboardingViewController with the provided information.
*/
- (nonnull instancetype)initWithTitle:(nullable NSString *)title body:(nullable NSString *)body image:(nullable UIImage *)image videoURL:(nullable NSURL *)videoURL buttonText:(nullable NSString *)buttonText actionBlock:(nullable action_callback)actionBlock;
- (nonnull instancetype)initWithTitle:(nullable NSString *)title body:(nullable NSString *)body image:(nullable UIImage *)image videoURL:(nullable NSURL *)videoURL inputView:(nullable UIView *)inputView buttonText:(nullable NSString *)buttonText actionBlock:(nullable dispatch_block_t)actionBlock;
- (nonnull instancetype)initWithTitle:(nullable NSString *)title body:(nullable NSString *)body image:(nullable UIImage *)image videoURL:(nullable NSURL *)videoURL inputView:(nullable UIView *)inputView buttonText:(nullable NSString *)buttonText actionBlock:(nullable dispatch_block_t)actionBlock withPadding:(BOOL*)withPadding;
/**
* @brief Method used to update the alpha value for all floating subviews (image, title, body, etc.)
*/
- (void)updateAlphas:(CGFloat)newAlpha;
@end