2013-06-29 90 views
1

我感興趣的過渡UIView類似於聯繫人應用程序的方式,當你點擊聯繫人編輯。 You can see a [crummy] GIF這裏供參考。已經定義的值滑動到它們的位置進行編輯,並且新字段淡入。UIView過渡像Contacts.app

我已經查看了UIView過渡文檔,但沒有看到如何做到這一點。 A UIViewAnimationOptionTransitionCrossDissolve並不完全。我想我可以將每個領域的動畫變成它的位置,然後淡入全視圖,但這似乎是錯誤的做法。

+1

這可能是一個UITableViewAnimation ......可能具體到集團的TableView風格。 –

+0

我認爲你是對的。現在查看「UITableView」的文檔。 https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITableViewCell_Class/Reference/Reference.html#//apple_ref/occ/instm/UITableViewCell/setEditing:animated: – swilliams

回答

0

Contacts.app看起來像UITableViewAnimation,正如RazorSharp在上面的評論中所說的那樣。如果您不使用UITableView,則必須手動完成該效果。

0

好吧我基本上想要像聯繫人應用程序一樣的過渡。我已經註冊了2個單元格,其中一個用於查看使用UILabels,另一個用於包含UITextField的編輯。我認爲cellForRowAtIndexPath中的開關單元標識符取決於我是否正在編輯。爲了讓動畫漸變我用

-(void)setEditing:(BOOL)editing animated:(BOOL)animated 
{ 
    [super setEditing:editing animated:animated]; 
    [UIView transitionWithView: self.tableView 
        duration: 0.35f 
        options: UIViewAnimationOptionTransitionCrossDissolve 
       animations: ^(void) 
    { 
     [self.tableView reloadData]; 
    } 
       completion: nil]; 
} 

這是從下面的問題

Have a reloadData for a UITableView animate when changing

這給出了一個微妙的褪色拍攝。我發現另一種選擇是要求 [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationFade];

類似的影響,但我認爲這是一個有點不太乾淨