小编Pre*_*sor的帖子

表脚中的UIButton没有响应

对于自定义表格页脚,我使用以下代码

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    if(editmode) {
    if(footerView == nil) {
        //allocate the view if it doesn't exist yet
        footerView  = [[UIView alloc] init];

        //we would like to show a gloosy red button, so get the image first
        UIImage *image = [[UIImage imageNamed:@"button_green.png"] stretchableImageWithLeftCapWidth:8 topCapHeight:8];

        //create the button
        UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
        [button setBackgroundImage:image forState:UIControlStateNormal];

        //the button should be as big as a table view cell
        [button setFrame:CGRectMake(10, 3, 300, 44)];

        //set title, font size and font …
Run Code Online (Sandbox Code Playgroud)

iphone xcode uibutton uitableview

4
推荐指数
1
解决办法
3137
查看次数

标签 统计

iphone ×1

uibutton ×1

uitableview ×1

xcode ×1