FIRIAMModalViewController.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. /*
  2. * Copyright 2018 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <TargetConditionals.h>
  17. #if TARGET_OS_IOS
  18. #import <UIKit/UIKit.h>
  19. #import "FirebaseInAppMessaging/Sources/DefaultUI/FIRCore+InAppMessagingDisplay.h"
  20. #import "FirebaseInAppMessaging/Sources/DefaultUI/Modal/FIRIAMModalViewController.h"
  21. @interface FIRIAMModalViewController ()
  22. @property(nonatomic, readwrite) FIRInAppMessagingModalDisplay *modalDisplayMessage;
  23. @property(weak, nonatomic) IBOutlet UIImageView *imageView;
  24. @property(weak, nonatomic) IBOutlet UILabel *titleLabel;
  25. @property(weak, nonatomic) IBOutlet UIButton *actionButton;
  26. @property(weak, nonatomic) IBOutlet UIView *messageCardView;
  27. @property(weak, nonatomic) IBOutlet UITextView *bodyTextView;
  28. @property(weak, nonatomic) IBOutlet UIButton *closeButton;
  29. // this is only needed for removing the layout errors in interface builder. At runtime
  30. // we determine the height via its content size. So disable this at runtime.
  31. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *fixedMessageCardHeightConstraint;
  32. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *messageCardHeightMaxInTabletCase;
  33. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *maxActionButtonHeight;
  34. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *bodyTextViewHeightConstraint;
  35. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *buttonTopToBodyBottomConstraint;
  36. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *imageActualHeightConstraint;
  37. // constraints manipulated further in portrait mode
  38. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *titleLabelHeightConstraint;
  39. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *buttonBottomToContainerBottomInPortraitMode;
  40. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *imageTopToTitleBottomInPortraitMode;
  41. // constraints manipulated further in landscape mode
  42. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *imageWidthInLandscapeMode;
  43. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *titleTopToCardViewTop;
  44. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *cardLeadingMarginInLandscapeMode;
  45. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *maxCardHeightInLandscapeMode;
  46. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *imageTopToCardTopInLandscapeMode;
  47. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *bodyTopToTitleBottomInLandScapeMode;
  48. @end
  49. static CGFloat VerticalSpacingBetweenTitleAndBody = 24;
  50. static CGFloat VerticalSpacingBetweenBodyAndActionButton = 24;
  51. // the padding between the content and view card's top and bottom edges
  52. static CGFloat TopBottomPaddingAroundContent = 24;
  53. // the minimal padding size between msg card and app window's top and bottom
  54. static CGFloat TopBottomPaddingAroundMsgCard = 30;
  55. // the horizontal spacing between image column and text/button column in landscape mode
  56. static CGFloat LandScapePaddingBetweenImageAndTextColumn = 24;
  57. @implementation FIRIAMModalViewController
  58. + (FIRIAMModalViewController *)
  59. instantiateViewControllerWithResourceBundle:(NSBundle *)resourceBundle
  60. displayMessage:(FIRInAppMessagingModalDisplay *)modalMessage
  61. displayDelegate:
  62. (id<FIRInAppMessagingDisplayDelegate>)displayDelegate
  63. timeFetcher:(id<FIRIAMTimeFetcher>)timeFetcher {
  64. UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"FIRInAppMessageDisplayStoryboard"
  65. bundle:resourceBundle];
  66. if (storyboard == nil) {
  67. FIRLogError(kFIRLoggerInAppMessagingDisplay, @"I-FID300001",
  68. @"Storyboard '"
  69. "FIRInAppMessageDisplayStoryboard' not found in bundle %@",
  70. resourceBundle);
  71. return nil;
  72. }
  73. FIRIAMModalViewController *modalVC = (FIRIAMModalViewController *)[storyboard
  74. instantiateViewControllerWithIdentifier:@"modal-view-vc"];
  75. modalVC.displayDelegate = displayDelegate;
  76. modalVC.modalDisplayMessage = modalMessage;
  77. modalVC.timeFetcher = timeFetcher;
  78. return modalVC;
  79. }
  80. - (FIRInAppMessagingDisplayMessage *)inAppMessage {
  81. return self.modalDisplayMessage;
  82. }
  83. - (IBAction)closeButtonClicked:(id)sender {
  84. [self dismissView:FIRInAppMessagingDismissTypeUserTapClose];
  85. }
  86. - (IBAction)actionButtonTapped:(id)sender {
  87. #pragma clang diagnostic push
  88. #pragma clang diagnostic ignored "-Wdeprecated-declarations"
  89. FIRInAppMessagingAction *action = [[FIRInAppMessagingAction alloc]
  90. initWithActionText:self.modalDisplayMessage.actionButton.buttonText
  91. actionURL:self.modalDisplayMessage.actionURL];
  92. #pragma clang diagnostic pop
  93. [self followAction:action];
  94. }
  95. - (void)viewDidLoad {
  96. [super viewDidLoad];
  97. // make the background half transparent
  98. [self.view setBackgroundColor:[UIColor.grayColor colorWithAlphaComponent:0.5]];
  99. self.messageCardView.layer.cornerRadius = 4;
  100. // populating values for display elements
  101. self.titleLabel.text = self.modalDisplayMessage.title;
  102. self.bodyTextView.text = self.modalDisplayMessage.bodyText;
  103. if (self.modalDisplayMessage.imageData) {
  104. [self.imageView
  105. setImage:[UIImage imageWithData:self.modalDisplayMessage.imageData.imageRawData]];
  106. self.imageView.contentMode = UIViewContentModeScaleAspectFit;
  107. }
  108. self.messageCardView.backgroundColor = self.modalDisplayMessage.displayBackgroundColor;
  109. self.titleLabel.textColor = self.modalDisplayMessage.textColor;
  110. self.bodyTextView.textColor = self.modalDisplayMessage.textColor;
  111. self.bodyTextView.selectable = NO;
  112. if (self.modalDisplayMessage.actionButton.buttonText.length != 0) {
  113. [self.actionButton setTitle:self.modalDisplayMessage.actionButton.buttonText
  114. forState:UIControlStateNormal];
  115. self.actionButton.backgroundColor = self.modalDisplayMessage.actionButton.buttonBackgroundColor;
  116. [self.actionButton setTitleColor:self.modalDisplayMessage.actionButton.buttonTextColor
  117. forState:UIControlStateNormal];
  118. self.actionButton.layer.cornerRadius = 4;
  119. if (self.modalDisplayMessage.bodyText.length == 0) {
  120. self.buttonTopToBodyBottomConstraint.constant = 0;
  121. }
  122. } else {
  123. // either action button text is empty or nil
  124. // hide the action button and reclaim the space below the buttom
  125. FIRLogDebug(kFIRLoggerInAppMessagingDisplay, @"I-FID300002",
  126. @"Modal view to be rendered without action button");
  127. self.maxActionButtonHeight.constant = 0;
  128. self.actionButton.clipsToBounds = YES;
  129. self.buttonTopToBodyBottomConstraint.constant = 0;
  130. }
  131. [self.view addConstraint:self.imageActualHeightConstraint];
  132. self.imageActualHeightConstraint.active = YES;
  133. self.fixedMessageCardHeightConstraint.active = NO;
  134. }
  135. // for text display UIview, which could be a UILabel or UITextView, decide the fit height under a
  136. // given display width
  137. - (CGFloat)determineTextAreaViewFitHeightForView:(UIView *)textView
  138. withWidth:(CGFloat)displayWidth {
  139. CGSize displaySize = CGSizeMake(displayWidth, FLT_MAX);
  140. return [textView sizeThatFits:displaySize].height;
  141. }
  142. // In both landscape or portrait mode, the title, body & button are aligned vertically and they form
  143. // together have an impact on the height for that column. Many times, we need to calculate a
  144. // suitable heights for them to help decide the layout. The height calculation is influced by quite
  145. // a few factors: the text lenght of title and body, the presence/absense of body & button and
  146. // available card/window sizes. So these are wrapped within
  147. // estimateTextButtomColumnHeightWithDisplayWidth which produce a TitleBodyButtonHeightInfo struct
  148. // to give the estimates of the heights of different elements.
  149. struct TitleBodyButtonHeightInfo {
  150. CGFloat titleHeight;
  151. CGFloat bodyHeight;
  152. // this is the total height of title plus body plus the button. Notice that button or body are
  153. // optional and the result totaColumnlHeight factor in these cases correctly
  154. CGFloat totaColumnlHeight;
  155. };
  156. - (struct TitleBodyButtonHeightInfo)estimateTextBtnColumnHeightWithDisplayWidth:
  157. (CGFloat)displayWidth
  158. withMaxColumnHeight:(CGFloat)maxHeight {
  159. struct TitleBodyButtonHeightInfo resultHeightInfo;
  160. CGFloat titleFitHeight = [self determineTextAreaViewFitHeightForView:self.titleLabel
  161. withWidth:displayWidth];
  162. CGFloat bodyFitHeight = self.modalDisplayMessage.bodyText.length == 0
  163. ? 0
  164. : [self determineTextAreaViewFitHeightForView:self.bodyTextView
  165. withWidth:displayWidth];
  166. CGFloat bodyFitHeightWithPadding = self.modalDisplayMessage.bodyText.length == 0
  167. ? 0
  168. : bodyFitHeight + VerticalSpacingBetweenTitleAndBody;
  169. CGFloat buttonHeight =
  170. self.modalDisplayMessage.actionButton == nil
  171. ? 0
  172. : self.actionButton.frame.size.height + VerticalSpacingBetweenBodyAndActionButton;
  173. // we keep the spacing even if body or button is absent.
  174. CGFloat fitColumnHeight = titleFitHeight + bodyFitHeightWithPadding + buttonHeight;
  175. if (fitColumnHeight < maxHeight) {
  176. // every element get space that can fit the content
  177. resultHeightInfo.bodyHeight = bodyFitHeight;
  178. resultHeightInfo.titleHeight = titleFitHeight;
  179. resultHeightInfo.totaColumnlHeight = fitColumnHeight;
  180. } else {
  181. // need to restrict heights of certain elements
  182. resultHeightInfo.totaColumnlHeight = maxHeight;
  183. if (self.modalDisplayMessage.bodyText.length == 0) {
  184. // no message body, title will try to expand to take all the available height
  185. resultHeightInfo.bodyHeight = 0;
  186. if (self.modalDisplayMessage.actionButton == nil) {
  187. resultHeightInfo.titleHeight = maxHeight;
  188. } else {
  189. // button height, if not 0, already accommodates the space above it
  190. resultHeightInfo.titleHeight = maxHeight - buttonHeight;
  191. }
  192. } else {
  193. // first give title up to 40% of available height
  194. resultHeightInfo.titleHeight = fmin(titleFitHeight, maxHeight * 2 / 5);
  195. CGFloat availableBodyHeight = 0;
  196. if (self.modalDisplayMessage.actionButton == nil) {
  197. availableBodyHeight =
  198. maxHeight - resultHeightInfo.titleHeight - VerticalSpacingBetweenTitleAndBody;
  199. } else {
  200. // body takes the rest minus button space
  201. availableBodyHeight = maxHeight - resultHeightInfo.titleHeight - buttonHeight -
  202. VerticalSpacingBetweenTitleAndBody;
  203. }
  204. if (availableBodyHeight > bodyFitHeight) {
  205. resultHeightInfo.bodyHeight = bodyFitHeight;
  206. // give some back to title height since body does not use up all the allocation
  207. resultHeightInfo.titleHeight += (availableBodyHeight - bodyFitHeight);
  208. } else {
  209. resultHeightInfo.bodyHeight = availableBodyHeight;
  210. }
  211. }
  212. }
  213. FIRLogDebug(kFIRLoggerInAppMessagingDisplay, @"I-FID300003",
  214. @"In heights calculation (max-height = %lf, width = %lf), title heights is %lf, "
  215. "body height is %lf, button height is %lf, total column heights are %lf",
  216. maxHeight, displayWidth, resultHeightInfo.titleHeight, resultHeightInfo.bodyHeight,
  217. buttonHeight, resultHeightInfo.totaColumnlHeight);
  218. return resultHeightInfo;
  219. }
  220. // the following two layoutFineTunexx methods make additional adjustments for the view layout
  221. // in portrait and landscape mode respectively. They are supposed to be triggered from
  222. // viewDidLayoutSubviews since certain dimension sizes are only available there
  223. - (void)layoutFineTuneInPortraitMode {
  224. // for tablet case, since we use a fixed card height, the reference would be just the card height
  225. // for non-tablet case, we want to use a dynamic height , so the reference would be the window
  226. // height
  227. CGFloat heightCalcReference = 0;
  228. if (self.messageCardHeightMaxInTabletCase.active) {
  229. heightCalcReference =
  230. self.messageCardView.frame.size.height - TopBottomPaddingAroundContent * 2;
  231. } else {
  232. heightCalcReference = self.view.window.frame.size.height - TopBottomPaddingAroundContent * 2 -
  233. TopBottomPaddingAroundMsgCard * 2;
  234. // Factor in space for the top notch on iPhone X*.
  235. #if defined(__IPHONE_11_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
  236. if (@available(iOS 11.0, *)) {
  237. heightCalcReference -= self.view.safeAreaInsets.top;
  238. }
  239. #endif // defined(__IPHONE_11_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
  240. }
  241. FIRLogDebug(kFIRLoggerInAppMessagingDisplay, @"I-FID300004",
  242. @"The height calc reference is %lf "
  243. "with frame height as %lf",
  244. heightCalcReference, self.view.window.frame.size.height);
  245. // this makes sure titleLable gets correct width to be ready for later's height estimate for the
  246. // text & button column
  247. [self.messageCardView layoutIfNeeded];
  248. // we reserve approximately 1/3 vertical space for image
  249. CGFloat textBtnTotalAvailableHeight =
  250. self.modalDisplayMessage.imageData ? heightCalcReference * 2 / 3 : heightCalcReference;
  251. struct TitleBodyButtonHeightInfo heights =
  252. [self estimateTextBtnColumnHeightWithDisplayWidth:self.titleLabel.frame.size.width
  253. withMaxColumnHeight:textBtnTotalAvailableHeight];
  254. self.titleLabelHeightConstraint.constant = heights.titleHeight;
  255. self.bodyTextViewHeightConstraint.constant = heights.bodyHeight;
  256. if (self.modalDisplayMessage.imageData) {
  257. UIImage *image = [UIImage imageWithData:self.modalDisplayMessage.imageData.imageRawData];
  258. CGSize imageAvailableSpace = CGSizeMake(self.titleLabel.frame.size.width,
  259. heightCalcReference - heights.totaColumnlHeight -
  260. self.imageTopToTitleBottomInPortraitMode.constant);
  261. CGSize imageDisplaySize = [self fitImageInRegionSize:imageAvailableSpace
  262. withImageSize:image.size];
  263. FIRLogDebug(kFIRLoggerInAppMessagingDisplay, @"I-FID300005",
  264. @"Given actual image size %@ and available image display size %@, the actual"
  265. "image display size is %@",
  266. NSStringFromCGSize(image.size), NSStringFromCGSize(imageAvailableSpace),
  267. NSStringFromCGSize(imageDisplaySize));
  268. // for portrait mode, no need to change image width since no content is shown side to
  269. // the image
  270. self.imageActualHeightConstraint.constant = imageDisplaySize.height;
  271. } else {
  272. // no image case
  273. self.imageActualHeightConstraint.constant = 0;
  274. self.imageTopToTitleBottomInPortraitMode.constant = 0;
  275. }
  276. }
  277. - (CGSize)fitImageInRegionSize:(CGSize)regionSize withImageSize:(CGSize)imageSize {
  278. if (imageSize.height <= regionSize.height && imageSize.width <= regionSize.width) {
  279. return imageSize; // image can be fully rendered at its original dimension
  280. } else {
  281. CGFloat regionRatio = regionSize.width / regionSize.height;
  282. CGFloat imageRaio = imageSize.width / imageSize.height;
  283. if (regionRatio < imageRaio) {
  284. // bound on the width dimension
  285. return CGSizeMake(regionSize.width, regionSize.width / imageRaio);
  286. } else {
  287. return CGSizeMake(regionSize.height * imageRaio, regionSize.height);
  288. }
  289. }
  290. }
  291. // for devices of 4 inches or below (iphone se, iphone 5/5s and iphone 4s), reduce
  292. // the padding sizes between elements in the text/button column for landscape mode
  293. - (void)applySmallerSpacingForInLandscapeMode {
  294. if (self.modalDisplayMessage.bodyText.length != 0) {
  295. VerticalSpacingBetweenTitleAndBody = self.bodyTopToTitleBottomInLandScapeMode.constant = 12;
  296. }
  297. if (self.modalDisplayMessage.actionButton != nil &&
  298. self.modalDisplayMessage.bodyText.length != 0) {
  299. VerticalSpacingBetweenBodyAndActionButton = self.buttonTopToBodyBottomConstraint.constant = 12;
  300. }
  301. }
  302. - (void)layoutFineTuneInLandscapeMode {
  303. // smaller spacing threshold is applied for screens equal or larger than 4.7 inches
  304. if (self.view.window.frame.size.height <= 321) {
  305. [self applySmallerSpacingForInLandscapeMode];
  306. }
  307. if (self.modalDisplayMessage.imageData) {
  308. UIImage *image = [UIImage imageWithData:self.modalDisplayMessage.imageData.imageRawData];
  309. CGFloat maxImageHeight = self.view.window.frame.size.height -
  310. TopBottomPaddingAroundContent * 2 - TopBottomPaddingAroundMsgCard * 2;
  311. CGFloat maxImageWidth = self.messageCardView.frame.size.width * 2 / 5;
  312. CGSize imageDisplaySize = [self fitImageInRegionSize:CGSizeMake(maxImageWidth, maxImageHeight)
  313. withImageSize:image.size];
  314. FIRLogDebug(kFIRLoggerInAppMessagingDisplay, @"I-FID300008",
  315. @"In landscape mode, image fit size is %@", NSStringFromCGSize(imageDisplaySize));
  316. // resize image per imageSize
  317. self.imageWidthInLandscapeMode.constant = imageDisplaySize.width;
  318. self.imageActualHeightConstraint.constant = imageDisplaySize.height;
  319. // now we can estimate the new card width given the desired image size
  320. // this assumes we use half of the window width for diplaying the text/button column
  321. CGFloat cardFitWidth = imageDisplaySize.width + self.view.window.frame.size.width / 2 +
  322. LandScapePaddingBetweenImageAndTextColumn;
  323. self.cardLeadingMarginInLandscapeMode.constant =
  324. fmax(15, (self.view.window.frame.size.width - cardFitWidth) / 2);
  325. } else {
  326. self.imageWidthInLandscapeMode.constant = 0;
  327. self.imageActualHeightConstraint.constant = 0;
  328. // card would be of 3/5 width of the screen in landscape
  329. self.cardLeadingMarginInLandscapeMode.constant = self.view.window.frame.size.width / 5;
  330. }
  331. // this makes sure titleLable gets correct width to be ready for later's height estimate for the
  332. // text & button column
  333. [self.messageCardView layoutIfNeeded];
  334. struct TitleBodyButtonHeightInfo heights =
  335. [self estimateTextBtnColumnHeightWithDisplayWidth:self.titleLabel.frame.size.width
  336. withMaxColumnHeight:self.view.frame.size.height -
  337. TopBottomPaddingAroundContent * 2 -
  338. TopBottomPaddingAroundMsgCard * 2];
  339. self.titleLabelHeightConstraint.constant = heights.titleHeight;
  340. self.bodyTextViewHeightConstraint.constant = heights.bodyHeight;
  341. // Adjust the height of the card
  342. // are we bound by the text/button column height or image height ?
  343. CGFloat cardHeight = fmax(self.imageActualHeightConstraint.constant, heights.totaColumnlHeight) +
  344. TopBottomPaddingAroundContent * 2;
  345. self.maxCardHeightInLandscapeMode.constant = cardHeight;
  346. // with the new card height, align the image and the text/btn column to center vertically
  347. self.imageTopToCardTopInLandscapeMode.constant =
  348. (cardHeight - self.imageActualHeightConstraint.constant) / 2;
  349. self.titleTopToCardViewTop.constant = (cardHeight - heights.totaColumnlHeight) / 2;
  350. }
  351. - (void)viewDidLayoutSubviews {
  352. [super viewDidLayoutSubviews];
  353. if (self.traitCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular ||
  354. self.traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact) {
  355. FIRLogDebug(kFIRLoggerInAppMessagingDisplay, @"I-FID300010",
  356. @"Modal view rendered in landscape mode");
  357. [self layoutFineTuneInLandscapeMode];
  358. } else {
  359. FIRLogDebug(kFIRLoggerInAppMessagingDisplay, @"I-FID300009",
  360. @"Modal view rendered in portrait mode");
  361. [self layoutFineTuneInPortraitMode];
  362. }
  363. // always scroll to the top in case the body area is scrollable
  364. [self.bodyTextView setContentOffset:CGPointZero];
  365. }
  366. - (void)viewWillAppear:(BOOL)animated {
  367. [super viewWillAppear:animated];
  368. // close any potential keyboard, which would conflict with the modal in-app messagine view
  369. [[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder)
  370. to:nil
  371. from:nil
  372. forEvent:nil];
  373. if (self.modalDisplayMessage.campaignInfo.renderAsTestMessage) {
  374. FIRLogDebug(kFIRLoggerInAppMessagingDisplay, @"I-FID300011",
  375. @"Flushing the close button since this is a test message.");
  376. [self flashCloseButton:self.closeButton];
  377. }
  378. }
  379. - (void)flashCloseButton:(UIButton *)closeButton {
  380. closeButton.alpha = 1.0f;
  381. [UIView animateWithDuration:2.0
  382. delay:0.0
  383. options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionRepeat |
  384. UIViewAnimationOptionAutoreverse |
  385. UIViewAnimationOptionAllowUserInteraction
  386. animations:^{
  387. closeButton.alpha = 0.1f;
  388. }
  389. completion:^(BOOL finished){
  390. // Do nothing
  391. }];
  392. }
  393. @end
  394. #endif // TARGET_OS_IOS