View跳转到Controller先创建控制器

/**
 *  @author JackRen
 *
 *  创建一个视图控制器便于从view跳转到controller
 *
 *  @return UIViewController
 */
-(UIViewController *)viewController {
    for (UIView *next = [self superview]; next; next = next.superview) {
        UIResponder *responder = [next nextResponder];
        if ([responder isKindOfClass:[UIViewController class]]) {
            return (UIViewController *)responder;
        }
    }
    return nil;
}

你可能感兴趣的:(iOS,Xcode,Object-c)