Create a UITableView with two rows. Now, on click of UIButton this tableView will appear like drop-down list and will disappear again on click (toggle case). Below function helps in creating an animation effect on UITableView.
////////////////////////////////////////////////////////
// Method : animateTableViewDown
// Params : nil
// Description : To animate clinic selection tableview down
////////////////////////////////////////////////////////
-(void)animateTableViewDown {
float tableHeight = ([clinicList count]*CELL_HEIGHT)>141?141:([clinicList count]*CELL_HEIGHT);
[UIView animateWithDuration:.5 delay:0.0 options:UIViewAnimationOptionTransitionCurlDown animations:^{
clinicListTableView.frame = CGRectMake(self.clinicSelectionButton.frame.origin.x, self.clinicSelectionButton.frame.origin.y+self.clinicSelectionButton.frame.size.height, self.clinicSelectionButton.frame.size.width, tableHeight);
clinicListTableView.hidden = NO;
} completion:^(BOOL finished) {
}];
}
////////////////////////////////////////////////////////
// Method : animateTableViewUp
// Params : nil
// Description : To animate clinic selection tableview up
////////////////////////////////////////////////////////
-(void)animateTableViewUp {
[UIView animateWithDuration:1 delay:0.0 options:UIViewAnimationOptionTransitionCurlUp animations:^{
clinicListTableView.frame = CGRectMake(self.clinicSelectionButton.frame.origin.x, self.clinicSelectionButton.frame.origin.y+self.clinicSelectionButton.frame.size.height, self.clinicSelectionButton.frame.size.width,0);
clinicListTableView.hidden =YES;
} completion:^(BOOL finished) {
}];
}
No comments:
Post a Comment