簡體   English   中英

添加子視圖時,UIView的動畫停止

[英]UIView's animations stopped when adding a subview

這是我使用情節提要創建的視圖:

在此處輸入圖片說明

雲,頭像圖像按鈕和其他文本按鈕等是其子視圖。 在其viewDidAppear方法中,我添加了幾種動畫方法,這些方法使雲層水平“浮動”,例如:

[UIView animateWithDuration:4.0f
                          delay:0.0f
                        options:(UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat | UIViewAnimationOptionAllowUserInteraction)
                     animations:^{
                         _cloud1.frame = its new frame so that it looks to float horizontally;
                     }
                     completion:nil];

現在,我有了另一個使用XIB文件創建的子視圖。 它基本上是一個自定義大小的子視圖,當點擊頭像圖像按鈕時將顯示該子視圖(我們可以將其視為社交應用程序中的“編輯個人資料屏幕”)。 我在此動畫塊中添加了它(請注意,它只是出現在紫色圓圈的頂部,而實際上並未刪除):

_editProfileViewController = [[EditProfileViewController alloc] initWithNibName:nil bundle:nil];
[self addChildViewController:_editProfileViewController];
[_editProfileViewController didMoveToParentViewController:self];

[UIView transitionWithView:self.view duration:0.3 options:(UIViewAnimationOptionTransitionCrossDissolve) animations:^
{
    [self.view addSubview:_editProfileViewController.view];

} completion:NULL];

在此處輸入圖片說明

問題:當我這樣做時,所有雲都停止動畫(而過渡仍然有效)。

有任何想法嗎? 謝謝。

幾個小時后,我的頭撞到牆上,看來這是一個iOS模擬器錯誤。 在設備上一切正常。

注意任何面臨相同問題的人:

操作系統:Mavericks 10.9.4

Xcode:5.1.1

iOS模擬器目標:iOS 7.1

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM