我有一个导航栏,其中有一个自定义按钮,按钮点击事件有一个自定义弹出菜单,当我点击一个表行didselectrowatindexpath方法没有调用时有一个表。
我正在使用此代码请解决此问题
在此输入代码
-(void)backButtonClicked1
{
// create and configure the view
CGRect cgRct = CGRectMake(220, 30, 93, 135); //define size and position of view
myView = [[UIView alloc] initWithFrame:cgRct];
myView.backgroundColor=[UIColor clearColor];
[myView setUserInteractionEnabled:YES];
UIButton *btnpop=[[UIButton alloc]initWithFrame:CGRectMake(0, 0, 93, 140)];
[btnpop setUserInteractionEnabled:YES];
[btnpop setImage:[UIImage imageNamed:@"popupbg@2x.png"] forState:UIControlStateNormal];
[myView addSubview:btnpop];
//[self.navigationController.navigationBar bringSubviewToFront:myView];
// [myView release];
table = [[UITableView alloc]initWithFrame:CGRectMake(1,20,90,114)
style:UITableViewStylePlain];
[table setUserInteractionEnabled:YES];
table.backgroundColor = [UIColor clearColor];
table.separatorColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"popupline@2x.png"]];
table.scrollEnabled=NO;
table.layer.borderColor = [UIColor clearColor].CGColor;
table.layer.borderWidth=1.0;
table.layer.cornerRadius = 4;
[table setDataSource:self];
[table setDelegate:self];
[myView addSubview:table];
myView.autoresizesSubviews = YES;
//allow it to tweak size of elements in view
[self.navigationController.navigationBar addSubview:myView];
[self.navigationController.navigationBar bringSubviewToFront:table];
}
答案 0 :(得分:2)
你应该添加这个
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Do your code here...
}
相应的.m类的方法。
答案 1 :(得分:1)
正如你所写的代表= self& datasource = self然后你想写你的代表&自我类中的数据源方法。
请执行
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Do your code here...
}