2012-10-29 102 views
0

我想通过点击一个按钮来展开我的UITableViewUIView的高度,以显示更多细节,就像App Store中的选项一样,当您想要查看该应用的更多更新时。这是否有任何教程?extend UIView或UITableView

回答

0

好吧我要回答我自己的问题。可能有一个更简单的方法,但如果有人有同样的问题,你可以使用这个: 1.在视图上添加UIButton 2.在.h文件中制作一个NSInteger i并在viewDidLoad中给出i=0。 3.当用户点击UIView无形按钮:

-(IBAction) clickMyView (id) sender { 
if (i==0){ 
i=1; 
[self changeView]; 
} 
else{ 
i=0; 
[self changeView]; 
} 

4.设置chageView

-(void) changeView{ 
if (i==0){ 
     [UIView beginAnimations : nil context:nil]; 
     [UIView setAnimationDuration:0.3]; 
     [UIView setAnimationBeginsFromCurrentState:TRUE];   

     // Change the view back to it's normal size here 
     [UIView commitAnimations]; 

} 
else{ 
      [UIView beginAnimations : nil context:nil]; 
      [UIView setAnimationDuration:0.3]; 
      [UIView setAnimationBeginsFromCurrentState:TRUE]; 

      // Change the view to the new size here 
      [UIView commitAnimations]; 

}