ios 如何在 Swift 中创建日历视图

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36414637/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 08:51:46  来源:igfitidea点击:

How can I make calendar view in Swift

iosswiftiphonecalendar

提问by Kira

I want to make simple calendar app in Swift 2, but I don't know where to start. I know there are some great calendar components available in cocopoads but docs for them are unfinished and as a beginner it is hard for me to read them and investigate code. I downloaded some popular cocoapods and played with them but that one functionalty I need is missing.

我想在 Swift 2 中制作简单的日历应用程序,但我不知道从哪里开始。我知道 cocopoads 中有一些很棒的日历组件,但它们的文档尚未完成,作为初学者,我很难阅读它们并研究代码。我下载了一些流行的 cocoapods 并与它们一起玩,但缺少我需要的一项功能。

I want to make simple menstrual diary for a practice with dates and other stuff. I imagined this would be simple but after a day of investigating I thing it is rather hard. Maybe I'm wrong.

我想制作简单的月经日记,用于日期和其他内容的练习。我以为这很简单,但经过一天的调查,我觉得这很困难。也许我错了。

So how I make my own calendar view? Should I start with tableview and collection view for dates?

那么我如何制作自己的日历视图?我应该从日期的表格视图和集合视图开始吗?

Can somebody give me some pointers, I'm lost at this point. Shoud I somehow learn to make my own view (I am a beginner so maybe this is too hard) or shoud I use some custom calendar?

有人可以给我一些指点,我在这一点上迷路了。我应该以某种方式学会创建自己的视图(我是初学者,所以这可能太难了)还是应该使用一些自定义日历?

回答by FlowUI. SimpleUITesting.com

Apple has nocalendar control, and many developers are lost in how to build one.

Apple没有日历控件,许多开发人员不知道如何构建日历控件。

A good cocoapod that is well documented is this one. It was developed by myself. If you need help setting up things, I can provide that. Full tutorials to get you started located here.

这是有据可查的一个很好的cocoapod是这一个。它是我自己开发的。如果您需要帮助进行设置,我可以提供。可让您入门的完整教程位于此处

If however, you want to know how it was built inside out so that you can build one yourself, then you can check out this link. It shows you in detail how it was built using a UICollectionView. Since you said you are new to programming, the first option is easier in my honest opinion for now.

但是,如果您想知道它是如何由内而外构建的,以便您可以自己构建一个,那么您可以查看此链接。它详细展示了它是如何使用 UICollectionView 构建的。既然你说你是编程的新手,我认为现在第一个选项更容易。

But you're a coder, and at some point you should learn. So I suggest learning swift/objective-c until you become comfortable with it. Start out with simple projects like creating a table view etc. Learn how delegation works etc.

但你是一名编码员,在某些时候你应该学习。所以我建议学习 swift/objective-c 直到你对它感到满意为止。从简单的项目开始,比如创建表格视图等。了解委托的工作原理等。

Once you are better at views, delegation, etc, then you will be more comfortable to create you own calendar control.

一旦您更擅长视图、委派等,那么您将更容易创建自己的日历控件。