下拉菜单Demo

if (showList) {//如果下拉框已显示,什么都不做
        return;
    }else {//如果下拉框尚未显示,则进行显示
        CGRect sf = self.frame;
        sf.size.height = frameHeight;
        //把dropdownList放到前面,防止下拉框被别的控件遮住
        [self.superview bringSubviewToFront:self];
        tv.hidden = NO;
        showList = YES;//显示下拉框
        CGRect frame = tv.frame;
        frame.size.height = 0;
        tv.frame = frame;
        frame.size.height = tabheight;
        [UIView beginAnimations:@"ResizeForKeyBoard" context:nil];
        [UIView setAnimationCurve:UIViewAnimationCurveLinear];
        self.frame = sf;
        tv.frame = frame;
        [UIView commitAnimations];

猜你喜欢

转载自792783226.iteye.com/blog/2237786