以编程方式向表格视图单元格添加按钮。 [英] Add buttons programatically to table view cells.

查看:84
本文介绍了以编程方式向表格视图单元格添加按钮。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计们我可以添加和删除单元格到我的表视图。我想为每个添加的单元格添加两个按钮。有人可以帮帮我吗?我找了这个,我找不到任何地方!我会喜欢一些帮助!非常感谢! :D

Hey guys i can add and delete cells to my table view. I want two buttons for each cell thats added. Could someone help me please? Ive looked for this and i cannot find it anywhere!! I would love some help! Thanks a lot! :D

推荐答案

添加按钮作为您的单元格的子视图。给它。我已经给出了样本

Add the button as subview for your cell.Tats it.I have given the sample

//Create ur cell then do the following    
UIButton *newBtn=[UIButton buttonWithType:UIButtonTypeCustom];
        [newBtn setFrame:CGRectMake(10,5,55,55)];
        [newBtn addTarget:self action:@selector(urSelctor:) forControlEvents:UIControlEventTouchUpInside];

        [cell addSubview:newBtn];

这篇关于以编程方式向表格视图单元格添加按钮。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆