我想知道在Mobile Safari中显示网站标题的UILabel是如何创建的?它显然是某种子类,我尝试使用我自己的子类来复制它,但它看起来不一样。我也不知道他们使用的是哪种字体:/有人能帮我吗?:)
这是我的课程:
CGSize shadowOffset = self.shadowOffset;
UIColor *textColor = self.textColor;
CGContextRef c = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(c, 1);
CGContextSetTextDrawingMode(c, kCGTextStroke);
self.textColor = [UIColor grayColor];
[super drawTextInRect:rect];
CGContextSetTextDrawingMode(c, kCGTextFill);
self.textColor = textColor;
self.shadowOffset = CGSizeMake(0, 0);
[super drawTextInRect:rect];
self.shadowOffset = shadowOffset;发布于 2010-08-27 04:07:23
看起来像是阴影偏移为(0,1)的基本UILabel。唯一困难的部分是找到他们使用的确切字体和颜色。我猜这只是boldSystemFont的深蓝色字体颜色和白色阴影。您真的不需要为此创建一个子类。
编辑: UILabel:http://img823.imageshack.us/img823/1281/photo1w.png Mobile Safari比较:http://img840.imageshack.us/img840/1538/photo2q.png
我只是使用了界面构建器中给出的颜色,其中钨(深灰色)用于文本,银色(浅灰色)用于阴影。
https://stackoverflow.com/questions/3569301
复制相似问题