Ios can';不要按披露按钮/继续工作

Ios can';不要按披露按钮/继续工作,ios,objective-c,segue,disclosure,Ios,Objective C,Segue,Disclosure,我的segue似乎不起作用,不会弹出“披露”按钮: MADViewController.h #import <UIKit/UIKit.h> @interface MADViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> @property (nonatomic, strong) IBOutlet UITableView *tableView; @end #imp

我的segue似乎不起作用,不会弹出“披露”按钮:

MADViewController.h

#import <UIKit/UIKit.h>

@interface MADViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> 
@property (nonatomic, strong) IBOutlet UITableView *tableView;
@end
#import <UIKit/UIKit.h>
#import "Pokemonobj.h"

@interface PokeDetailViewController : UIViewController

@property (weak, nonatomic) IBOutlet UIImageView *recipePhoto;
@property (weak, nonatomic) IBOutlet UILabel *prepTimeLabel;
@property (weak, nonatomic) IBOutlet UITextView *ingredientTextView;

@property (nonatomic, strong) Pokemonobj *pokemon;

@end
#import <UIKit/UIKit.h>

@interface GameViewController : UIViewController
@property (nonatomic, strong) IBOutlet UIWebView *webView;

@end
PokeDetailViewController.h

#import <UIKit/UIKit.h>

@interface MADViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> 
@property (nonatomic, strong) IBOutlet UITableView *tableView;
@end
#import <UIKit/UIKit.h>
#import "Pokemonobj.h"

@interface PokeDetailViewController : UIViewController

@property (weak, nonatomic) IBOutlet UIImageView *recipePhoto;
@property (weak, nonatomic) IBOutlet UILabel *prepTimeLabel;
@property (weak, nonatomic) IBOutlet UITextView *ingredientTextView;

@property (nonatomic, strong) Pokemonobj *pokemon;

@end
#import <UIKit/UIKit.h>

@interface GameViewController : UIViewController
@property (nonatomic, strong) IBOutlet UIWebView *webView;

@end
口袋妖怪

#import <Foundation/Foundation.h>

@interface Pokemonobj : NSObject

@property (nonatomic, strong) NSString *name; // name of recipe
@property (nonatomic, strong) NSString *prepTime; // preparation time
@property (nonatomic, strong) NSString *imageFile; // image filename of recipe
@property (nonatomic, strong) NSArray *ingredients; // ingredients

@end
GameViewController.h

#import <UIKit/UIKit.h>

@interface MADViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> 
@property (nonatomic, strong) IBOutlet UITableView *tableView;
@end
#import <UIKit/UIKit.h>
#import "Pokemonobj.h"

@interface PokeDetailViewController : UIViewController

@property (weak, nonatomic) IBOutlet UIImageView *recipePhoto;
@property (weak, nonatomic) IBOutlet UILabel *prepTimeLabel;
@property (weak, nonatomic) IBOutlet UITextView *ingredientTextView;

@property (nonatomic, strong) Pokemonobj *pokemon;

@end
#import <UIKit/UIKit.h>

@interface GameViewController : UIViewController
@property (nonatomic, strong) IBOutlet UIWebView *webView;

@end

我不确定您是否需要查看代码的其他区域。但这是目前的片段。

您确定已在情节提要中设置了从单元格到PokeDetailViewController的连接,并已将segue标识符设置为PokeDetailViewController(@“showPokeDetail”)?如果没有添加:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self performSegueWithIdentifier:@"showPokeDetail" sender:nil];
}

//仍然记得从ViewController(而不是单元格)到PokeDetailViewController(@“showPokeDetail”)设置segue标识符,

您需要设置
单元格。accessoryType

试着做

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *simpleTableIdentifier = @"pokeCell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];

    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
    }

    Pokemonobj *pokemon = [pokemons objectAtIndex:indexPath.row];
   cell.textLabel.text = pokemon.name;
    cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
    return cell;
}
之后,您可以实现

- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath;
在情节提要中设置带有
@“showPokeDetail”
标识符的序列。并在上述实现中调用segue

[self-PerformsgueWithIdentifier:@“showPokeDetail”发件人:无]

注意:当您使用
accessoryType
时,将不会得到
NSIndexPath*indexPath=[self.tableView indexPathForSelectedRow]需要将所选索引存储在变量中