我用 NSLog(@"%@");
而NSLog的结果是'23204239423'我不解释你为什么......这只是一个例子.
我希望NSLog结果出现在UILabel中,是否可能?
我试过:Label.text = (@"%@");,它不起作用.
你知道我怎么做吗?
谢谢.
我的旧代码
sectorLabel.textAlignment = UITextAlignmentCenter;
Run Code Online (Sandbox Code Playgroud)
Xcode表示不推荐使用textAlignment.我如何使用新方法?
谢谢
我有一个UILabel在我的iPhone应用程序模拟器.它显示一个硬币计数,我有一个动作,计数增加1亿.我希望这个数字继续上升,但由于某种原因,一旦计数达到20亿,它会增加一个减号并开始倒计时,然后重新计算到20亿并再次退回,依此类推.
我希望能够显示更多的数字,即数万亿等...有谁知道这是怎么回事以及如何修复它所以标签数字将继续上升到我想要的高度.
我正在使用Xcode和Interface Builder并在模拟器中运行.我将数字存储在一个int变量中,如果这很重要的话.
我的程序目前有三十个UILabel,可能包含一到三位数字.我想让我的UILabels水平扩展和收缩,因为它们中的数字会改变大小.目前文本正在缩小,UILabels的大小保持不变.
如果只使用xib文件可以做到这一点,那么以编程方式执行此操作会更好,但如果不可能,那么这将是很好的.
谢谢
我正在尝试制作一个在横向和纵向模式下都能正确显示的标签.当我处于纵向模式时标签看起来很好但是当我切换到横向模式时标签没有正确对齐.当屏幕从一种模式切换到另一种模式时,有一种方法可以自动调整UI标签.
编辑: 这是我的代码
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(100 , 100, 100, 100)];
[label setText:@"xxx."];
label.adjustsFontSizeToFitWidth=YES;
[self.view addSubview:label];
[label release];
Run Code Online (Sandbox Code Playgroud)
我还创建了一个NStimer方法,在5秒后丢弃标签
我一直在尝试通过从AppDelegate.m到MainViewController.m的方法调用来更新UILabel一段时间.我真的不明白为什么这不起作用.该方法被称为allright,一切正常,除了最后一点更改/更新标签文本.
在applicationDidBecomeActive在AppDelegate中调用该方法updateLabelMethod在MainViewController它处理数据和更新标签.
MainViewController.h
UILabel *daysResultOutlet;
@interface MainViewController : UIViewController <FlipsideViewControllerDelegate>
@property (strong, nonatomic) IBOutlet UILabel *daysResultOutlet;
@end
@interface MainViewController ()
- (void) updateLabelMethod;
@end
Run Code Online (Sandbox Code Playgroud)
MainViewController.m
@synthesize daysResultOutlet;
- (void) updateLabelMethod {
NSString *value = @"test";
NSLog(@"Testing to print value: %@",value);
[daysResultOutlet setText:value]; //insert in label
}
Run Code Online (Sandbox Code Playgroud)
AppDelegate.m
#import "AppDelegate.h"
#import "MainViewController.h"
@interface MainViewController ()
@end
- (void)applicationDidBecomeActive:(UIApplication …Run Code Online (Sandbox Code Playgroud) 可能重复:
UILabel上的闪烁效果
如何UILabel在iPhone中眨眼.我也尝试过Google搜索.但这些问题正在激活标签以改变颜色.但我不需要改变颜色.我需要UILabel眨眼.可能吗?
我正在编程Objective C.我有一个UITableView用UILabel的.如何检测省略号UILabel?
不知道如何描述这个,但是最简单的方法是让UILabel显示加载,然后加载,然后加载..,然后加载......,然后重复?
我一直在研究计时器,但这似乎有点过分.有人知道一个很酷的快速技巧来拉掉这样的东西吗?谢谢!
上下文
UIViewController一个UINavigationController堆栈内的UIViewController我UILabel在(x,y)坐标(0,0)处以编程方式添加UILabel到self.view(这是在UIViewController中)或添加UILabel到a UIView,这UIView是self.containerViewself.containerView 通过以下代码创建并添加到视图中:
- (void)addContainerView
{
// Create a UIView with same frame as the screen bounds
CGRect containerViewFrame = [[UIScreen mainScreen] applicationFrame];
self.containerView = [[UIView alloc] initWithFrame:containerViewFrame];
// Give the UIView a red background
self.containerView.backgroundColor = [UIColor redColor];
// Add the view
[self.view addSubview:self.containerView];
}
Run Code Online (Sandbox Code Playgroud)
将UILabel通过该代码添加:
- (void)addTestLabel
{
self.navigationController.navigationBarHidden = YES;
CGRect frame = CGRectMake(0, 0, 100, …Run Code Online (Sandbox Code Playgroud)