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的常用代理方法-创新互联
地址分享:https://www.cdcxhl.com/article24/csdoce.html

成都网站建设公司_创新互联,为您提供网站维护全网营销推广微信小程序Google网站制作建站公司

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

绵阳服务器托管