• UIPickView的显示与消失方法


    //PickerView appear
    -(void)ShowPickerView:(UIPickerView*)PickerViewTag
    {
        if(PickerViewTag.superview==nil)
        {
            [self.view.window addSubview:PickerViewTag];
            CGRect screenRect=[[UIScreen mainScreen]applicationFrame];
            CGSize pickSize=[PickerViewTag sizeThatFits:CGSizeZero];
            CGRect startRect=CGRectMake(0.0, screenRect.origin.y+screenRect.size.height, pickSize.width, pickSize.height);
            PickerViewTag.frame=startRect;
            CGRect pickRect=CGRectMake(0.0, screenRect.origin.y+screenRect.origin.y+screenRect.size.height-pickSize.height, pickSize.width,pickSize.height);
           
            [UIView beginAnimations:nil context:NULL];
            [UIView setAnimationDuration:0.3];
            [UIView setAnimationDelegate:self];
            PickerViewTag.frame=pickRect;
            CGRect newFrame=self.view.frame;
            newFrame.size.height-=PickerViewTag.frame.size.height;
            self.tableView.frame=newFrame;
            [UIView commitAnimations];
        }
       
    }
    //PickerView Disappear
    -(void)PickerViewDisappear:(UIPickerView *)PickerViewTag
    {
        CGRect screenRect = [[UIScreen mainScreen] applicationFrame];
        CGRect endFrame=PickerViewTag.frame;
        endFrame.origin.y=screenRect.origin.y+screenRect.size.height;
       
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:0.3];
        [UIView setAnimationDelegate:self];
        [UIView setAnimationDidStopSelector:@selector(slideDown:)];
        PickerViewTag.frame=endFrame;
        CGRect newFrame = self.tableView.frame;
        newFrame.size.height+=PickerViewTag.frame.size.height;
       
        self.tableView.frame=newFrame;
           
        // deselect the current table row
        NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
        [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
        [PickerViewTag removeFromSuperview];
    }
  • 相关阅读:
    prepareStatement的用法和解释
    java socket报文通信(一) socket的建立
    java多线程小结
    Java_XML操作
    socket实例2
    socket实例1
    Socket小结
    从源码角度理解android动画Interpolator类的使用
    android使用属性动画代替补间动画
    OKHttp的简单使用
  • 原文地址:https://www.cnblogs.com/mac_arthur/p/1708357.html
Copyright © 2020-2023  润新知