UIView viewWithTag 0问题 [英] UIView viewWithTag 0 problem

查看:123
本文介绍了UIView viewWithTag 0问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在IB中查看我有很多项目(包括视图本身)。只有一个项目有标记0,但是下面的行适用于任何UITextBox,然后是带有标记0的那个。注意只有一个UITextBox有标记0,原因:

On view in IB I have numerous items (including view itself). ONLY one item has tag 0, yet following line works for ANY UITextBox other then the one with tag 0. Note that only ONE UITextBox has tag 0, why:


(UITextField *) [self.view  viewWithTag:0]).text = @"foo";

有趣的是,当收到标签为0的元素的触发事件时,我可以毫无问题地获得标签0的值。

Interesting that when triggered event received for the element with tag 0, I can get value of Tag 0 with no problem.

查找标签0元素是否有限制?

Is there a limitation to look for tag 0 elements?

推荐答案

所有视图都默认为0标记,因此如果您获得0视图它可以是任何观点。要使其工作,您需要使用在程序或界面构建器中设置的非零值。

这篇关于UIView viewWithTag 0问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆