【发布时间】:2011-11-30 12:06:05
【问题描述】:
亲爱的程序员,
我正在创建一个如下所示的 customLabel 类:
@interface CustomLabel : UILabel {
NSString *customBundlePath;
}
@implementation CustomLabel
- (void)drawTextInRect:(CGRect)rect
{
NSString *result=[self getLocalvalue:self.text];
[result drawInRect:rect withFont:self.font];
}
-(void)awakeFromNib
{
NSLog(@"%@",self.text);
}
-(NSString *)getLocalvalue:(NSString*)textTolocalize
{
// some code
return localizedText;
}
但我的问题是,在 nib 加载时,drawTextInRect 方法只为 Label 调用一次。
如果视图再次被popig显示,那么每个customLabel对象会执行哪个方法?
请帮帮我。 提前谢谢。
【问题讨论】:
-
只是为了本地化,你没有创建自定义标签。
-
但是我的应用程序中有很多视图。所以我需要它 Satyam 先生
-
在 ViewWillApper 方法中进行
-
在 UILabel 类中,ViewWillApper 方法不可用。不是吗?
标签: iphone uilabel awakefromnib