猿问

tableviewcell上的button不响应点击事件

问题描述:自定义了一个tableviewcell,上面有一个button,添加了一个单击事件。tableviewcell是用xib做的,点击响应在cell的类里实现。现在单击button没有响应。
疑惑:应该跟xcode和ios版本没有关系。我是从另一个工程直接拷贝来的,另一个工程里可以响应,这两个工程的区别是arc和mrc,mrc的有响应,arc的没响应,不知道有没有关系。我换了另一种方法——在viewcontrol里处理cell,在(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath里给button添加事件并在该viewcontrol里处理事件,可还有没有响应,只能响应cell的点击事件。
请高手指教。
-(IBAction)actionJiaohao:(id)sender
{
NSString*selectType=nil;
if(self.oyised.length)
{
[self.jiaohaosetBackgroundImage:[UIImageimageNamed:@"jiahao.png"]
forState:UIControlStateNormal];
selectType=@"-1";
self.oyised=nil;
}
else
{
[self.jiaohaosetBackgroundImage:[UIImageimageNamed:@"jianhao.png"]
forState:UIControlStateNormal];
selectType=@"1";
self.oyised=selectType;
}
OYIDefaultStore*oyids=
[[OYIDefaultStorealloc]init];
user_ID=[oyidsOyiRead:@"userid"];
creator_Name=[oyidsOyiRead:@"name"];
[selfcreateActivityView:self.superview];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0),^{
//发送信息到服务器
post*publish=[[postalloc]init];
[publishOyiPostPl:user_ID
keyID:selectType
Creator:creator_Name
QQID:self.QQID
HTID:nil
title:nil
text:nil
image:nil
phone:nil
password:nil
username:nil
url:@"aplMyAttentionUpdate"];
dispatch_async(dispatch_get_main_queue(),^{
[selfstopActivityView];
});
});
}
扬帆大鱼
浏览 617回答 2
2回答
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答