0

新手问题在这里 -

我在视图控制器 m 中有这个方法:

-(void) backToHP:(id<SwitchViewProtocol>) fromView{

    [(UIView *)self.currentView removeFromSuperview];
    [self.currentView clearView];
    [self.view addSubview:_hpView];
    self.currentView = nil;

    CATransition *animation = [CATransition animation];
    [animation setDuration:0.2];
    [animation setType:kCATransitionPush];
    [animation setSubtype:kCATransitionFromLeft];
    [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];

    [[self.view layer] addAnimation:animation forKey:@"SwitchToView1"];
}

我尝试从子类中调用它。h子类:

@interface SetNotificationClass : UIView < SwitchViewProtocol> {

    habitsViewController *hvc;

}

@property (nonatomic, retain) habitsViewController *hvc;

子类 m:

@synthesize hvc;

- (IBAction)saveNotificationClick:(id)sender {
   // [self scheduleAlarm];
    [hvc backToHP:nil];
}

我收到“找不到方法”错误。任何的想法?

谢谢

4

1 回答 1

0

你在哪里初始化hvc?您不会将 backToHP: 发送回零,对吗?我也可能只是将视图控制器设置为视图的委托,而不是创建一个新属性。

于 2012-06-25T07:02:33.523 回答