저는이 말을 처음 접했으므로 그 일을하는 데 어려움이 있습니다. 타이틀은 셀 안에있는 버튼처럼 내 목표도 들어 맞 춥니 다. 이것은에 필요한 경우 여기에서의 ViewController 코드입니다어떻게하면 단추를 tableview 셀 안에 넣을 수 있습니까?
using System;
using System.Collections.Generic;
using System.Text;
using Foundation;
using UIKit;
namespace TableView
{
public class TableSource : UITableViewSource
{
string[] tableItems;
string cellIdentifier = "TableCell";
public TableSource (string[] items)
{
tableItems = items;
}
public override nint RowsInSection(UITableView tableview, nint section)
{
return tableItems.Length;
}
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
{
new UIAlertView("Alert", "You selected: " + tableItems[indexPath.Row], null, "Next Site", null).Show();
tableView.DeselectRow(indexPath, true);
}
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
UITableViewCell cell = tableView.DequeueReusableCell(cellIdentifier);
if (cell == null)
cell = new UITableViewCell(UITableViewCellStyle.Subtitle, cellIdentifier);
cell.TextLabel.Text = tableItems[indexPath.Row];
if(indexPath.Row > -1)
cell.DetailTextLabel.Text = tableItems[indexPath.Row - 0];
return cell;
}
}
}
: 당신이 당신이이 질문에 대답하기 위해 도움이 될 수 있도록, 내 코드를보고 싶다면, 여기에 코드입니다.
당신이이 같은 cellForRowAtIndexPath 함수 내에서 누르고있는 어떤 버튼을 볼 수 있도록 버튼에 태그를 추가 할 필요가 모든
답변에 문제가있는 경우이를 삭제하거나 편집 할 수 있습니다. – AnonymUser