I have relod the UITableview data on segment click as show in image below:
Now I want to animate tableView reload on UISegmentedControl click same as navigationController pushViewController
but there appears transition screen between the movement of table view
I have try to use following but was unable to get totally what i wants to -(void)SwipeGestureRecognize{
UISwipeGestureRecognizer * swipeleft=[[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeleft:)];
swipeleft.direction=UISwipeGestureRecognizerDirectionLeft;
[self.view addGestureRecognizer:swipeleft];
UISwipeGestureRecognizer * swiperight=[[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swiperight:)];
swiperight.direction=UISwipeGestureRecognizerDirectionRight;
[self.view addGestureRecognizer:swiperight];
}
-(void)swipeleft:(UISwipeGestureRecognizer*)gestureRecognizer
{
//past Order
[UITableView animateWithDuration:0.5f animations:^{
self.tableView.frame = CGRectOffset(self.tableView.frame, [Util window_width],0);
}];
self.tableView.frame = CGRectMake(0, 0, 0-[Util window_width], [Util window_height]);
[UITableView animateWithDuration:0.5f animations:^{
self.tableView.frame = CGRectOffset(self.tableView.frame, [Util window_width],0);
}];
segmetControl.selectedSegmentIndex = 1;
[self action:Nil];
}
-(void)swiperight:(UISwipeGestureRecognizer*)gestureRecognizer
{
//Current Order
[UITableView animateWithDuration:0.5f animations:^{
self.tableView.frame = CGRectOffset(self.tableView.frame, [Util window_width],0);
}];
self.tableView.frame = CGRectMake(0, 0, 0-[Util window_width], [Util window_height]);
[UITableView animateWithDuration:0.5f animations:^{
self.tableView.frame = CGRectOffset(self.tableView.frame, [Util window_width],0);
}];
segmetControl.selectedSegmentIndex = 0;
[self action:Nil];
}
Please use below code.