[英]count view controllers
I can't seem to get the number of view controllers in the view controller stack. 我似乎无法获得视图控制器堆栈中视图控制器的数量。
NSUInteger *viewControllerCount = self.navigationController.viewControllers.count;
I can loop through the view controllers and NSLog the objects within but I can't do a simple count. 我可以遍历视图控制器和NSLog内的对象,但是我不能做一个简单的计数。 If I try to access this pointer, the ap crashes... no Log, no error message, nada.
如果我尝试访问此指针,则ap崩溃...没有日志,没有错误消息,nada。 Please help!
请帮忙!
我相信您想删除*
:
NSUInteger viewControllerCount = self.navigationController.viewControllers.count;
The reason why this isn't working is because NSUInteger
isn't an object type, it's a language type. 之所以不起作用,是因为
NSUInteger
不是对象类型,而是语言类型。
Therefore, you need to remove the *
from the assignment and it should work just fine. 因此,您需要从分配中删除
*
,它应该可以正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.