Skip to content
i5ting edited this page May 20, 2013 · 4 revisions

在board里也可以这样写

- (void)handleUISignal_Lesson2View2:(BeeUISignal *)signal
{
    [super handleUISignal:signal];

    if ( [signal is:Lesson2View2.TEST] )
    {
        [[self navigationController] pushViewController:[LogBoardView board] animated:YES];
    }
}

然后 LogBoardViewController的back按钮事件处理:

-(void)backBtnClicked:(UIButton *)sender
{
    [self.navigationController setNavigationBarHidden:NO];
    [self.navigationController popToRootViewControllerAnimated:YES];
}

这样做其实是可以,但不推荐

原因是Bee_UIStack.m里对UIView进行了扩展

@implementation UIView(BeeUIStack)

- (BeeUIStack *)stack
{
	UINavigationController * controller = [self navigationController];
	if ( controller && [controller isKindOfClass:[BeeUIStack class]] )
	{
		return (BeeUIStack *)controller;
	}
	else
	{
		return nil;
	}
}

- (UINavigationController *)navigationController
{
	UIViewController * controller = [self viewController];
	if ( controller )
	{
		return controller.navigationController;
	}
	else
	{
		return nil;
	}
}

@end
Clone this wiki locally