我需要在 UILabel 中的 AppDelegate.mm 中显示一个 int。我是新手,所以我不知道该怎么做。Xcode,4.3。现在,我在 xib 文件中有一个 UILabel,在 AppDelegate.mm 中有一个整数 y。我只需要在 UILabel 中显示 y。我不知道如何将这两个东西联系起来。谢谢,汤姆·洛瑞。
			
			1107 次
		
3 回答
            3        
        
		
试试这个函数在标签中显示一个 Int:
self.label.text = [NSString stringWithFormat:@"%d", 3];
于 2013-01-27T04:57:12.513   回答
    
    
            0        
        
		
self.Yourlabel.text = [NSString stringWithFormat:@"%d", Y];
变量 Y 是声明的 int 值...
于 2013-01-27T04:59:37.187   回答
    
    
            0        
        
		
       int yourInt;
       NSString *num = [NSString stringWithFormat:@"%d", youInt];
       UILabel *lab = [UILabel alloc] initWhithFrame:CGRectMake(200, 200, 100, 30)];
       lab.text = num;
       [self.view addSubView:lab];
于 2013-01-27T04:59:37.247   回答