大家好,我已经编写了以下函数,该函数已附加到UIButton
s Action.It 被调用并在单击按钮时按要求工作,但在类中的其他地方调用时不起作用。
-(void)punchcardDetailButtonClicked{
NSLog(@"punchcardDetailButtonClicked");
PunchCardDetailsViewController *punchCardDetailsViewController=[[PunchCardDetailsViewController alloc] initWithNibName:@"PunchCardDetailsViewController" bundle:nil];
UINavigationController *nvcLocation=[[UINavigationController alloc] initWithRootViewController:punchCardDetailsViewController];
punchCardDetailsViewController.modalTransitionStyle=UIModalTransitionStyleFlipHorizontal;
UIColor* navBarColor = [UIColor colorWithRed:128.0/255.0 green:99.0/255.0 blue: 64.0/255.0 alpha:0.0];
nvcLocation.navigationBar.tintColor = navBarColor;
[self presentModalViewController:nvcLocation animated:YES];
[nvcLocation release];
[punchCardDetailsViewController release];
}
我已经在同一个类中使用了它,[self punchcardDetailButtonClicked]
但这不能按预期工作。虽然,NSlog
在这两种情况下都会打印出来。