滑动scrowview 上方菜单选项的下环线随着移动 效果

UIView:
-(id)initWithFrame:(CGRect)frame id)target SEL)sel
{
    self=[super initWithFrame:frame];
    if (self)
    {
        scrow.delegate=target;
        m_showBar=[[ShowBar alloc]initWithFrame:CGRectMake(15, 28, 70, 2)];
        [self addSubview:m_showBar];

    }
    return self;
}

-(void)setShowBarPoint CGPoint)barPoint
{
    m_showBar.frame=CGRectMake(15+barPoint.x/3+3, 28, 70, 2);
}


UIViewController:
- (void)viewDidLoad
{
//第一次启动实例化uiview
}

-(void)scrollViewDidScroll:(UIScrollView *)scrollView  //uiscrowView代理方法
//offset changes
{
    CGPoint rec=scrowView.scrow.contentOffset; //得到scrow的实时动态contentOffSet坐标
    [scrowView setShowBarPoint:rec];
}

猜你喜欢

转载自cydd.iteye.com/blog/2171110