简体   繁体   English

在不同的视图和日期选择器中更新

[英]Update in a different view and date picker

I wanna update my date/time from a view and update that date/time to another textfield in a different view, how do i link this together?我想从一个视图更新我的日期/时间并将该日期/时间更新到另一个视图中的另一个文本字段,我如何将它们链接在一起?

And for a date picker how do i enable the hr and mins to be scrollable at all times, for eg.对于日期选择器,我如何使小时和分钟始终可滚动,例如。 in my case if the time is 10 now.就我而言,如果现在是 10 点。 onli 10, 11 and 12 will be able to be scrollable (black) the rest of the hrs will be in grey.仅 10、11 和 12 将能够滚动(黑色),小时的 rest 将显示为灰色。

For the updatinf of textfield with picker value you need to take value from picker and pass that value to the view where the textfield is.This can be done when you are push or present to the view controller or you can do that by NSUserDeaults.对于带有选择器值的文本字段的更新,您需要从选择器中获取值并将该值传递给文本字段所在的视图。这可以在您推送或呈现到视图 controller 时完成,或者您可以通过 NSUserDeaults 执行此操作。

Now for the picker part you can set the minimum time and maximum time which will help you to do the task you wanted to do(for the picker view).现在对于选择器部分,您可以设置最小时间和最大时间,这将帮助您完成您想做的任务(对于选择器视图)。 Hope i am clear.Do ask if you dont get anywhere.希望我很清楚。请问你是否没有得到任何地方。

For the first part of the question, where you want to update stuff from one view to another, you can either set it as a property in your class.对于问题的第一部分,您想将内容从一个视图更新到另一个视图,您可以将其设置为 class 中的property You can reference that class in another view and get the data in that variable.您可以在另一个视图中reference该 class 并获取该变量中的数据。 Or you can use NSUserDefaults for passing data back and forth.或者您可以使用NSUserDefaults来回传递数据。 And then just use [textField setText: stringfromClassOne] .然后只需使用[textField setText: stringfromClassOne]

For the PickerView and for having stuff in a different colour, use the property of alpha and then reduce the alpha for fields below specific time.对于PickerView和具有不同颜色的东西,使用alpha的属性,然后减少特定时间以下字段的 alpha。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM