How do I add a reflection to a UILabel. IOS
(newbie) question here. Searched but could not find this specific answer anywhere.... I want to add a reflection (and a glow if possible) to a UILabel. I saw apple's reflection project code but it works for a UIImage not label.
just adding it to a simple clock:
- (void)runTimer //Starts a timer which messages runClock every 0.5sec
{
myTicker = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(runClock)
userInfo:nil repeats:YES];
}
- (void)runClock
{
NSDateFormatter *formatter = [[[NSDateFormatter alloc] init]
autorelease]; NSDate *date = [NSDate date];
// This will produce a time that looks like "12:15:00 PM".
[formatter setTimeStyle:NSDateFormatterMediumStyle];
[clockLabel setText:[formatter stringFromDate:date]]开发者_高级运维;
}
I wrote an article on how to generate reflections of any UI element or group of elements. The canned technique can be dropped into your project and is really easy to use. Source code and the article can be found at http://aptogo.co.uk/2011/08/no-fuss-reflections/
I think the right way would be subclassing UILabel and override the drawRect method using quartz2d
here's where you and quartz2d can get to know each other a little better. here's where you and quartz2d can get to know each other a little better.
精彩评论