tableView中的一些问题-新手必看

来源:互联网 发布:淘宝网与阿里巴巴 编辑:程序博客网 时间:2024/05/17 22:54

错过了就可惜把~!!



1. 不要在tableView的方法中创建属性,tableView的方法每次都走,下一个会覆盖上一个的效果



2 .tableView索引cell 的坐标方法
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
   
 NSLog(@"section = %ld, row = %ld", (long)indexPath.section , (long)indexPath.row);
   
   
 CGRect popoverRect = [tableView convertRect:[tableView rectForRowAtIndexPath:indexPath] toView:[tableView superview]];
   
 NSLog(@"%f",popoverRect.origin.y);
}


3.//分割线充满
    _tableView.separatorInset = UIEdgeInsetsMake(0000);


 //取消cell的分割线
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;




4.sugue 传值
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    
if ([segue.identifier isEqualToString:@"search"]) {
         
ShowTopicsViewController * showVC = [segue destinationViewController];
        
NSLog(@"sdadasd = %@",[segue destinationViewController]);
        showVC.
aField = self.topTopicLabel.text;
        
    }
    
if ([segue.identifier isEqualToString:@"gotoWeb"]) {
        
WebViewController * webVC = (WebViewController *)((UINavigationController  *)[segue destinationViewController]).topViewController;
        webVC.
urlStr =  _linkWebUrl;  
        
//NSLog(@" ... = %@", webVC.urlStr);
        
    }
  
}




5//根据storyboard 标识索引 vc (没有连线)
    self.detailVC = [self.storyboard instantiateViewControllerWithIdentifier:@"detailVC"];









0 0
原创粉丝点击