[英]TableView Index with Button Title
我有兩個表視圖TableView1,TableView2。 當我點擊任何按鈕時,TableView1包含一個按鈕列表,TableView2將出現一個數字列表。
現在,當我選擇任何數字時,需要在單擊的按鈕中顯示該數字。
因為我是IOS的新手,任何人都可以幫我解決這個問題嗎?
btn_select=[[UIButton alloc]init];
btn_select.frame=CGRectMake([UIScreen mainScreen].bounds.size.width-245,10,55, 27);
btn_select.layer.cornerRadius=5;
btn_select.backgroundColor=[UIColor orangeColor];
[btn_select addTarget:self action:@selector(NumberButtonclicke:) forControlEvents:UIControlEventTouchUpInside];
btn_select.tag=indexPath.row;
[btn_select.titleLabel setTextAlignment:NSTextAlignmentCenter];
[btn_select setTitle:@"1" forState:UIControlStateNormal];
[cell addSubview:btn_select];
-(void)NumberButtonclicke:(UIButton *)Sender
{
}
-(void)NumberButtonclicke:(UIButton *)Sender
{
CGPoint buttonPosition = [sender convertPoint:CGPointZero toView: Yourtableview];
NSIndexPath *indexPath = [Yourtableview indexPathForRowAtPoint:buttonPosition];
NSString *str = [Yourarary objectAtIndex:indexPath.row]; // Your Number list
NSLog(@"Number is ---%@", str)
}
可能只需要一個帶有折疊的tableView並在點擊時展開Section。
以下是重復的答案: iOS中UITableView中的展開/折疊部分
在選擇行時,在重新加載表時更改了Section Header
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.