0

I have been looking at how the mini-calander date is displayed. Is it done with NSCalendar or using open source projects?

I can't seem to find out how to do it. If anyone knows how its done or a tutorial about it that would be great. When the date is clicked it opens out a UIDatePicker. I expect it must be done using NSCalendar but cannot see anything about it.

Screenshot of Calendar Date

4

1 回答 1

0

通常,您会使用 NSDate。

获取当前日期和月份,然后创建图标大小的标签,将文本居中并将它们添加到图标的子视图中。我现在正在打电话,所以我无法给出详细的描述。但那将是我会做的方式。

编辑

为了回答您将 UILabel 添加到导航栏 (navigationItem) 的标题视图的评论,我在 navigationItem.titleView 中添加了一个 UISlider:

CGRect frame = CGRectMake(50, 150, 220, 23);
slider = [[UISlider alloc] initWithFrame:frame];
[slider addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged];
[slider setBackgroundColor:[UIColor clearColor]];
slider.continuous = YES; // Make the slider 'stick' as it is moved.
[slider setMinimumValue:0];
[slider setMaximumValue:((float)[numbers count] - 1)];
//slider.transform = CGAffineTransformMakeRotation(M_PI * - 0.5);
self.navigationItem.titleView = slider;

您可以通过添加一个包含其他几个 UIViews(2) 的 UIView(1) 与这些 UIViews(2) 中的标签完全相同,就像之前发布的图像所做的那样......然后添加一个控制事件或手势识别器到允许某种类型的动作发生的 UIView(2)...

老实说,我已经意识到,在应用程序开发中几乎任何事情都是可能的。重要的是你如何处理你的问题以及你是否准备好迎接挑战......

如果您仍然有问题,请发送评论,我会按照您的要求做,但自己动手是一个很好的学习体验......但我是来帮忙的 :)

于 2013-07-23T17:33:57.653 回答