开发者

Add buttons programmatically to table view cells [closed]

开发者 https://www.devze.com 2023-04-12 07:18 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetoric开发者_JS百科al andcannot be reasonably answered in its current form. F
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetoric开发者_JS百科al and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.

I can add and delete cells to my table view. How to have two buttons for each cell that's added?


Add the button as subview for your cell. That's it. I have given the sample:

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

[cell addSubview:newBtn];
0

精彩评论

暂无评论...
验证码 换一张
取 消