【问题标题】:Iphone Dev - Drop down list of Buttons when button pressedIphone Dev - 按下按钮时的下拉按钮列表
【发布时间】:2010-12-30 14:00:56
【问题描述】:

我需要实现一个按钮(假设在按下之前带有向下箭头的图片),按下时会打开一个下拉列表,我将动态设置其他按钮。 下拉需要使用某种动画一次显示一个按钮。

有没有首选的方法。 (以前从未使用过动画) 类似的源代码会有很大帮助。

谢谢

【问题讨论】:

    标签: objective-c cocoa-touch ios4 core-animation uibutton


    【解决方案1】:

    我做了类似的事情,我有一个带有导航栏的表格视图。该栏有一个按钮来显示/隐藏过滤器,它会从顶部向下动画。我使用的代码是:

      CGFloat filterViewHeight = kExtendedFilterViewHeight;
      if(![self includeSecondaryFilter])
       filterViewHeight = kDefaultFilterViewHeight;
    
      if(!allButton.selected && [self includeSecondaryFilter])
       filterViewHeight -= kSecondaryFilterHeight;
    
      filtersView.frame = CGRectMake(0.0, -filterViewHeight, 320.0, filterViewHeight);
      [self.view addSubview:filtersView];
    
      CGRect tableViewFrame = itemTableView.frame;
      CGRect filtersViewFrame = filtersView.frame;
    
      [UIView beginAnimations:nil context:NULL];
      [UIView setAnimationDuration:0.3];
      [UIView setAnimationDelegate:self];
    
      tableViewFrame.origin.y = filterViewHeight;
      tableViewFrame.size.height -= filterViewHeight;
      itemTableView.frame = tableViewFrame;
    
      filtersViewFrame.origin.y = 0.0;
      filtersView.frame = filtersViewFrame;
    
      [UIView commitAnimations];
    

    希望这会有所帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-22
      • 2012-04-22
      • 1970-01-01
      • 1970-01-01
      • 2011-08-07
      • 1970-01-01
      相关资源
      最近更新 更多