iphone – 表脚中的UIButton没有响应

iphone – 表脚中的UIButton没有响应,第1张

概述对于自定义表格页脚,我使用以下代码 - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { if(editmode) { if(footerView == nil) { //allocate the view if it doesn't ex 对于自定义表格页脚,我使用以下代码

- (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 color        [button setTitle:@"Photo" forState:UIControlStatenormal];        [button.TitleLabel setFont:[UIFont boldSystemFontOfSize:20]];        [button setTitlecolor:[UIcolor whitecolor] forState:UIControlStatenormal];        //set action of the button        [button addTarget:self action:@selector(selectExistingPicture) forControlEvents:UIControlEventtouchUpInsIDe];        //add the button to the vIEw        [footerVIEw addSubvIEw:button];        UIbutton *button2 = [UIbutton buttonWithType:UIbuttonTypeRoundedRect];        image = [[UIImage imagenamed:@"button_grey_dark.png"] stretchableImageWithleftCapWIDth:8 topCapHeight:8];        [button2 setBackgroundImage:image forState:UIControlStatenormal];        //the button should be as big as a table vIEw cell        [button2 setFrame:CGRectMake(10,50,Font size and Font color        [button2 setTitle:@"Note" forState:UIControlStatenormal];        [button2.TitleLabel setFont:[UIFont boldSystemFontOfSize:20]];        [button2 setTitlecolor:[UIcolor whitecolor] forState:UIControlStatenormal];        //set action of the button        [button2 addTarget:self action:@selector(mkFolder) forControlEvents:UIControlEventtouchUpInsIDe];        //add the button to the vIEw        [footerVIEw addSubvIEw:button2];        //      [button setupAsRedbutton];    }    //return the vIEw for the footer    return footerVIEw;    }     return nil;}

使用它,第一个按钮响应完美,但第二个按钮不记录任何事件.即使该函数不存在,也不会生成空函数错误.关于UItouchUpInsIDe未被识别的任何想法?

解决方法 卫生署!

在这段代码的正下方,我有

// specify the height of your footer section- (CGfloat)tableVIEw:(UItableVIEw *)tableVIEwheightForFooterInSection:(NSInteger)section {    //differ between your sections or if you    //have only on section return a static value    return 50;}

这使得UIVIEw忽略了50像素以下的任何东西.将它改为100,我很好.

总结

以上是内存溢出为你收集整理的iphone – 表脚中的UIButton没有响应全部内容,希望文章能够帮你解决iphone – 表脚中的UIButton没有响应所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1028960.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存