如何从uiview里面,获取其上层的uiviewcontroller
1个回答
展开全部
因为要在uitableviewcell里面的uiview模块里面,调用self.navigationcontroller pushviewcontroller推入一个新的viewcontroller,需要获取其上层的uiviewcontroller,找到如下的代码
id object = [self nextResponder];
while (![object isKindOfClass:[UIViewController class]] &&
object != nil) {
object = [object nextResponder];
}
UIViewController *uc=(UIViewController*)object;
id object = [self nextResponder];
while (![object isKindOfClass:[UIViewController class]] &&
object != nil) {
object = [object nextResponder];
}
UIViewController *uc=(UIViewController*)object;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询