资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

UITableView的常用代理方法-创新互联

//设置行高

目前创新互联公司已为1000+的企业提供了网站建设、域名、网络空间、网站托管、企业网站设计、鹤庆网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath{

    return 80;

}

//分区

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

{

    // Return the number of sections.

    return 3;

}

//设置每个区有多少行共有多少行

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

{

    return 2;

}

//设置区域的名称

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section;

{

   return @"123";

}

//是否允许行移动

-(BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath

{

    return YES;

}

//响应点击事件

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath

{

    NSLog(@"响应单击事件");

}

//小按钮的响应事件

- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath

{

    NSLog(@"accessoryButton的响应事件");

}

//删除按钮的名字

-(NSString*)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath

{

    return @"删除";

}

//设置滑动,

-(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath

{

    //ruturn NO不实现滑动

    return YES;

}

-(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath

{

    NSLog(@"手指撮动了");

    return UITableViewCellEditingStyleDelete;

//    //插入

//    return UITableViewCellEditingStyleInsert;

}

设置CELL的样式

//        cell.selectionStyle = UITableViewCellSelectionStyleBlue;

        //灰色

//    cell.selectionStyle = UITableViewCellSelectionStyleGray;

        //无颜色

//        cell.selectionStyle = UITableViewCellSelectionStyleNone;

        //向右箭头样式

//        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

        //向右箭头button

           cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;

 UITableViewCellStyleDefault,// Simple cell with text label and optional p_w_picpath view (behavior of UITableViewCell in iPhoneOS 2.x)

    UITableViewCellStyleValue1,// Left aligned label on left and right aligned label on right with blue text (Used in Settings)

    UITableViewCellStyleValue2,// Right aligned label on left with blue text and left aligned label on right (Used in Phone/Contacts)

    UITableViewCellStyleSubtitle

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


网页标题:UITableView的常用代理方法-创新互联
本文路径:http://cdkjz.cn/article/csdoce.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220