Newbee问题 -
我在视图控制器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];
}
我收到“找不到方法”错误。任何想法?
由于
答案 0 :(得分:0)
你在哪里初始化hvc?你没有发回toToHP:为零,对吗?我也可能只是将视图控制器设置为视图的委托,而不是创建新属性。