1. 程式人生 > >cell上 button點選彈出資訊提示框

cell上 button點選彈出資訊提示框


-(IBAction)onWarnInfo:(id)sender{
    
    <span style="white-space:pre">	</span>UIButton *btn=(UIButton *)sender;
        NSIndexPath *_indexPath=[NSIndexPath indexPathForRow:btn.tag inSection:0];
        UITableViewCell *_cell=[_tableView cellForRowAtIndexPath:_indexPath];
        CGRect rect=_cell.frame;
        
        float offset_y=rect.origin.y- _tableView.contentOffset.y+30.0;
    
    if (_warninfoView.superview) {
        if (_warninfoIndex==btn.tag) {           
        [_warninfoView removeFromSuperview];
        }
        else{
            //offy
            [_warninfoView setFrame:CGRectMake(0, offset_y, 320, 80)];
            
        }
    }else{
        _warninfoIndex=btn.tag;
        
        [_warninfoView setFrame:CGRectMake(0, offset_y, 320, 80)];
        [m_uivBackgound addSubview:_warninfoView];
    }
    
}