小编mnt*_*ell的帖子

以编程方式更改工具栏上的UILabel(UIBarButtonItem)的文本

我是初学的iPhone开发者.我的代码如下:

UIBarButtonItem *fixedSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];  
UILabel *lblTotCaratteri = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 25, 15)];
lblTotCaratteri.textAlignment = UITextAlignmentCenter;
lblTotCaratteri.font = [UIFont italicSystemFontOfSize:13.0];
lblTotCaratteri.textColor = [UIColor greenColor];
lblTotCaratteri.backgroundColor = [UIColor clearColor];
lblTotCaratteri.adjustsFontSizeToFitWidth = YES;
lblTotCaratteri.text = @"0";

UIBarButtonItem *lblCaratteri = [[UIBarButtonItem alloc] initWithCustomView: lblTotCaratteri];

inserimentoToolbar.items = [NSArray arrayWithObjects:fixedSpace, lblCaratteri, fixedSpace, nil];
Run Code Online (Sandbox Code Playgroud)

所以在我看来,我有一个UITextView,这个工具栏以编程方式创建.我想在每次向UITextView添加字符时更改标签文本.每次UITextView文本更改时,我都会显示每个按键的警报.我无法弄清楚如何更改标签文字.我希望我已经解释了我的情景.对不起我的英语不好.问候,卢卡.

iphone

6
推荐指数
2
解决办法
2万
查看次数

遍历二叉树的方法数量

考虑n个节点的二叉树.为了举例,请考虑以下树:

     1
   /   \
  2     3
 / \   / \
4   5 6   7
           \
            8
Run Code Online (Sandbox Code Playgroud)

有多少种不同的方法可以从根(顶部)节点开始完全遍历树,只移动到直接连接到已访问过的节点的未访问节点(即我可以从1到2到4但是然后到3)?

algorithm tree binary-tree binary-search-tree

4
推荐指数
1
解决办法
880
查看次数