我准备把头撞在桌子上。或者也许我太累了。任何人都可以借出第二眼,并告诉我为什么下面的最后一个if语句会产生错误?
非常感谢
#import "BAWelcomeViewController.h"
@interface BAWelcomeViewController ()
@end
@implementation BAWelcomeViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)viewWillAppear:(BOOL)animated {
if (![PFUser currentUser]) {
[self performSegueWithIdentifier:@"Show Login View" sender:self];
return;
}
[self performSegueWithIdentifier:@"Show Main View" sender:self];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)performSegueWithIdentifier:(NSString *)identifier sender:(id)sender {
if ([[segue identifier] isequaltostring:@"Show Login View") {
//do something here
}
}
答案 0 :(得分:1)
上下文有点稀疏,很难肯定你的意思,但看起来你已经复制并粘贴了其他地方的代码;
- (void)performSegueWithIdentifier:(NSString *)identifier sender:(id)sender {
if ([[segue identifier] isequaltostring:@"Show Login View") {
该方法已经使用标识符调用,而不是segue,所以您需要的只是;
- (void)performSegueWithIdentifier:(NSString *)identifier sender:(id)sender {
if ([identifier isequaltostring:@"Show Login View"]) {
答案 1 :(得分:0)
- (void)performSegueWithIdentifier:(NSString *)identifier sender:(id)sender {
if ([[segue identifier] isequaltostring:@"Show Login View") {
//do something here
}
}
不正确。尝试
- (void)performSegueWithIdentifier:(NSString *)identifier sender:(id)sender {
if ([identifier isEqualToString:@"Show Login View"]) {
//do something here
}
}
您没有segue
来致电identifier
。还解决了一些代码错误。