ショッキングなことに、この問題はまだ解決されていません (2012 年 9 月 25 日)。この問題について、私の複数の本や他の経験豊富な iOS 開発者を調査しました。pushViewController コードを追加すると修正されると思いましたが、解決しませんでした。誰かがこれについて私を助けることができるなら、私に知らせてください? 誰かがこの問題に対する答えを知っている場合、報奨金は依然としてこの質問を支持します。
アプリ内で accesoryButtonTappedRowWithIndexPath メソッドのコードを作成しようとしていますが、個々の開示ボタンをクリックすると新しい UI ビュー ウィンドウに移動する方法を見つけるのに苦労しています。Beginning IOS 5 Development のような本を何冊か購入しました。テーブルビューのセクションで、それがどのように行われるかの例を見ていますが、私の中ではうまくいかないようです。これは、私が現在持っているコードで、以下にリストされています。開示ボタンが選択されたときに「メッセージ」を表示しようとしているメッセージクラスが機能していることを証明していません。本のコードでアクセスできることがわかりますが、私のコードでは動作しないので、次のビューに移動できます。誰でもこれについて私を助けることができますか? 以下の画面は、テーブルのセルをクリックしたときの他のメソッド アクションが機能し、メッセージ アラートが正常にポップアップすることを示しています。
どうもありがとう。
- (void)tableView:(UITableView *)tableView
accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
if (NbhoodDetailController == nil)
{
NbhoodDetailController = [[LWWDisclosureDetailController alloc]initWithNibName:@"LWWDisclosureDetail" bundle:nil];
}
NbhoodDetailController.title = @"Getting Neighborhood Details";
NSUInteger row = [indexPath row];
NSString *SelectedNeighborhood = [ListBlocks objectAtIndex:row];
NSString *DetailMessage = [[NSString alloc]
initWithFormat:@"You pressed the button for the Neighborhood %@ to invest in.", SelectedNeighborhood];
NbhoodDetailController.title = SelectedNeighborhood;
NbhoodDetailController.message = DetailMessage;// <-- the "message" class isn't accessible for some reason as well so I can click on the disclosure button and give a message.
以下のインデックス コードの行のセル:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath//returns instances of the UITableViewCell class rows that have to be populated into the table view.
{
static NSString *NeighborhoodDBListCellIdentifier = @"NeighborhoodDBListCellIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NeighborhoodDBListCellIdentifier];//as table view cells scroll off the screen, they are placed into a queue of cells available to be reused. So im using those cells for the new rolls that scroll on the screen to assign them to.
if(cell == nil)//in case of no spare reuseable cells we create new ones here. If dequeueReusableCellWithIdentifier doesn't have any to spare.
{
cell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:NeighborhoodDBListCellIdentifier];
}
//assigning the images for the rows and also the disclosure buttons for each row
UIImage *image = [UIImage imageNamed:@"rowControlsIcon.png"];
cell.imageView.image = image;
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
NSUInteger row = [indexPath row];
cell.textLabel.text = [ListBlocks objectAtIndex:row];//the output results of what the cell is goes to the textLabel in the TableViewCell as text. Like "Armour Neighhborhood"
return cell;
}